Ask a Question related to ASP Database, Design and Development.
-
Guy Hocking #1
Conditional List Box in ASP
Hi there,
I am having a few problems compiling a list box that is conditional on what
is selected in another list box.
What i need is a List box (lstArea) that displays one thing when the List
Box (lstRegion) is selected East or West. Basically the areas will change
when East or West is selected in lstRegion.
The data comes from an SQL Server view, and my current non-working code is
as follows, my syntax in the SQL statement is completly wrong, i have no
idea how to go about this..
The View has 2 columns, vchrLong_Desc and vchrArea_Name, i want the new list
box (lstArea) to display vchrArea_Name when the List Box lstRegion displays
vchrLong_Desc.
************************
<select name="lstArea" size="1"><br>
<option value="">Please Select </option>
<%
Dim SQL, RS,
SQL = "SELECT * from vw_SOLS_RegionsAreas_u WHERE
vw_SOLS_RegionsAreas_u.vchrLong_Desc =" ("lstRegion")""
set RS = DataConnection.Execute(SQL)
If not RS.EOF then
while not RS.EOF
Response.write("<option
value='"&RS("vchrArea_Name")&"'>"&RS("vchrArea_Nam e")&"</option>")
RS.movenext()
wend
else
Response.write("")
end if
%>
</select>
***************************
Hope that is not too confusing,
I am new to ASP so you will have to forgive me for being nieve
Thanks in advance
Guy
Guy Hocking Guest
-
conditional bind
This is driving me absolutely nuts. What I want to do is simply check to make sure a value has been filled in or selected in my form and only bind... -
Conditional Table Row
I have a query that has records that have a group value: Group A, Group B, Group C, etc. I want to have a repeating region conditionally show the... -
Conditional sum?
FMP6, MacOSX.2 I've created a calc field using the aggregate Sum(score) to give me a "total points scored" for all related records in a... -
conditional sql statements
I have a shopping cart that I want to load items in that come from a huge scrolling form. In other words, when someone clicks on a category in our... -
Selectively removing or adding to a conditional list
Using Windows and Filemaker 5, I was wondering if it is possible to selectively remove (and then add back if necessary) to choices from a... -
Bob Barrows #2
Re: Conditional List Box in ASP
Guy Hocking wrote:
[url]http://www.aspfaq.com/show.asp?id=2270[/url]> Hi there,
>
> I am having a few problems compiling a list box that is conditional
> on what is selected in another list box.
> What i need is a List box (lstArea) that displays one thing when the
> List Box (lstRegion) is selected East or West. Basically the areas
> will change when East or West is selected in lstRegion.
>
> The data comes from an SQL Server view, and my current non-working
> code is as follows, my syntax in the SQL statement is completly
> wrong, i have no idea how to go about this..
> The View has 2 columns, vchrLong_Desc and vchrArea_Name, i want the
> new list box (lstArea) to display vchrArea_Name when the List Box
> lstRegion displays vchrLong_Desc.
>
Bob Barrows
PS. I realize you are new, so you probably are not aware that you've
committed a breach of netiquette here by posting an off-topic question.
Just so you know, ASP is server-side technology, ie, it operates on the web
server. By the time the client sees anything in the browser, ASP is usually
finished. All subsequent operations (such as responding to users' actions:
clicking with the mouse or selecting an option in a listbox) are no longer
ASP operations, making them off-topic for this newsgroup. The appropriate
newsgroups for this type of question (client-side code) are those that
contain "dhtml" (dynamic html) in their names, or
microsoft.public.scripting.jscript, or microsoft.public.scripting.vbscript.
With a few exceptions, questions about activity that occurs on the server
(server-side code) before the client sees the response in the browser, are
the only on-topic questions for these asp newsgroups. (I notice you included
the .iis newsgroup, which was totally inappropriate, since that newsgroup
deals with the web server itself). It helps to browse a little in the
newsgroups before posting to see which types of questions are deemed
appropriate - you may even discover the answer to your question without
posting. Use Google to seach for answers before posting: you will save
yourself (and us) some time.
I do congratulate you for cross-posting instead of multi-posting, however.
Nothing burns us up more than responding to a question in one newsgroup only
to find it's been answered in another group.
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Bob Barrows Guest
-
Guy Hocking #3
Re: Conditional List Box in ASP
Hi,
I appreciate your points made in your reply, however, the code i am talking
about may well be client side but it will post it to an ASP page to sort out
and display the detail.
Explain this to me, how will i get the data from the SQL server onto the
page in the first place? will it not need to be an ASP page in order to do
this - then sort out the client options once its there?
If this is incorrect forgive me, as i stated i am new to ASP and its
sisters.
Please forgive me, as i feel your response was kind of patronising, i
appreciate what you guys do as i frequently answer questions in the Exchange
newsgroups, but your post was simply a point being made rather than helping
me with my query.
Whether client or server side the operation still contains ASP at some
stage, making this post not so as in-appapropriate as you make out.
I will post to the apropriate newsgroups, my apologies to any other MVP with
their knickers in a twist,
Kind Regards
Guy Hocking
MCSE
"Bob Barrows" <reb01501@NOyahoo.SPAMcom> wrote in message
news:#wgIJyd1DHA.3140@tk2msftngp13.phx.gbl...web> Guy Hocking wrote:>> > Hi there,
> >
> > I am having a few problems compiling a list box that is conditional
> > on what is selected in another list box.
> > What i need is a List box (lstArea) that displays one thing when the
> > List Box (lstRegion) is selected East or West. Basically the areas
> > will change when East or West is selected in lstRegion.
> >
> > The data comes from an SQL Server view, and my current non-working
> > code is as follows, my syntax in the SQL statement is completly
> > wrong, i have no idea how to go about this..
> > The View has 2 columns, vchrLong_Desc and vchrArea_Name, i want the
> > new list box (lstArea) to display vchrArea_Name when the List Box
> > lstRegion displays vchrLong_Desc.
> >
> [url]http://www.aspfaq.com/show.asp?id=2270[/url]
>
> Bob Barrows
>
> PS. I realize you are new, so you probably are not aware that you've
> committed a breach of netiquette here by posting an off-topic question.
>
> Just so you know, ASP is server-side technology, ie, it operates on theusually> server. By the time the client sees anything in the browser, ASP ismicrosoft.public.scripting.vbscript.> finished. All subsequent operations (such as responding to users' actions:
> clicking with the mouse or selecting an option in a listbox) are no longer
> ASP operations, making them off-topic for this newsgroup. The appropriate
> newsgroups for this type of question (client-side code) are those that
> contain "dhtml" (dynamic html) in their names, or
> microsoft.public.scripting.jscript, orincluded> With a few exceptions, questions about activity that occurs on the server
> (server-side code) before the client sees the response in the browser, are
> the only on-topic questions for these asp newsgroups. (I notice youonly> the .iis newsgroup, which was totally inappropriate, since that newsgroup
> deals with the web server itself). It helps to browse a little in the
> newsgroups before posting to see which types of questions are deemed
> appropriate - you may even discover the answer to your question without
> posting. Use Google to seach for answers before posting: you will save
> yourself (and us) some time.
>
> I do congratulate you for cross-posting instead of multi-posting, however.
> Nothing burns us up more than responding to a question in one newsgroup> to find it's been answered in another group.
>
> --
> Microsoft MVP - ASP/ASP.NET
> Please reply to the newsgroup. This email account is my spam trap so I
> don't check it very often. If you must reply off-line, then remove the
> "NO SPAM"
>
>
Guy Hocking Guest
-
Harag #4
Re: Conditional List Box in ASP
if you reread Bobs post the very first line was helping you...
Look at all the links and that will tell you how to do it.
Basically you need CLIENT side code to change the drop down boxes with
information... once you get that look at it and learn how its doing
it.. once you got that then you can tell the client side code the date
from the ASP db you need.
If you find that client side javascript code is to advanced for you
then you will have to do it server side, but this is not as
"professional" as it calls back to the server each time.
check out matts site for more info.
[url]http://www.mattkruse.com/javascript/[/url]
Al.
On Thu, 8 Jan 2004 12:06:14 -0000, "Guy Hocking"
<guy.hocking@bradflack.com> wrote:
>, but your post was simply a point being made rather than helping
>me with my query.Harag Guest
-
Dan Boylett #5
Re: Conditional List Box in ASP
"Guy Hocking" <guy.hocking@bradflack.com> wrote in message
news:%23AJD5Sd1DHA.2388@TK2MSFTNGP09.phx.gbl...what> Hi there,
>
> I am having a few problems compiling a list box that is conditional onlist> is selected in another list box.
> What i need is a List box (lstArea) that displays one thing when the List
> Box (lstRegion) is selected East or West. Basically the areas will change
> when East or West is selected in lstRegion.
>
> The data comes from an SQL Server view, and my current non-working code is
> as follows, my syntax in the SQL statement is completly wrong, i have no
> idea how to go about this..
> The View has 2 columns, vchrLong_Desc and vchrArea_Name, i want the newdisplays> box (lstArea) to display vchrArea_Name when the List Box lstRegionThis last bit could be a problem.... for lots of reasons.> vchrLong_Desc.
>
> ************************
> <select name="lstArea" size="1"><br>
> <option value="">Please Select </option>
> <%
> Dim SQL, RS,
>
> SQL = "SELECT * from vw_SOLS_RegionsAreas_u WHERE
> vw_SOLS_RegionsAreas_u.vchrLong_Desc =" ("lstRegion")""
Are you having your page submit when the first box is selected? Are all your
select boxes in a Form?
You would need to have something like this :
<%
If Request.Form() <> "" Then ' Form submitted'
DropDown1 = Trim(Request.Form("DropDown1"))
If DropDown1 <> "" Then
sSQL = "SELECT * FROM vw_SOLS_RegionsAreas_u WHERE sw_etc = '" &
DropDown1 & "'"
Set RS = DataConn.Execute(SQL)
If NOt (RS.eof and RS.BOF) Then
Response.write "<Select name = ""DropDown2"">"
Do While Not Rs.Eof
Response.write "<option value = """ & RS("WhichEverIDField") &
""">" & RS("WhichEverTextField
Rs.Movenext
Loop
Response.write "</select>"
Else
Response.write "No records found!"
End If
RS.CLose
Set RS = Nothing
End If
%>
>
> set RS = DataConnection.Execute(SQL)
> If not RS.EOF then
> while not RS.EOF
> Response.write("<option
> value='"&RS("vchrArea_Name")&"'>"&RS("vchrArea_Nam e")&"</option>")
> RS.movenext()
> wend
> else
> Response.write("")
> end if
> %>
> </select>
> ***************************
>
> Hope that is not too confusing,
> I am new to ASP so you will have to forgive me for being nieve
>
> Thanks in advance
>
> Guy
>
>
Dan Boylett Guest
-
Jeff Cochran #6
Re: Conditional List Box in ASP
On Thu, 8 Jan 2004 12:06:14 -0000, "Guy Hocking"
<guy.hocking@bradflack.com> wrote:
The client side code isn't on topic in the asp.db group. The ASP part>I appreciate your points made in your reply, however, the code i am talking
>about may well be client side but it will post it to an ASP page to sort out
>and display the detail.
is barely on topic for the other groups you posted to. To get the
best answer to your quesion, use the correct groups. And when someone
suggests a different group, follow that advice.
Well, umm... Not completely. But that's not an issue. You asked>Explain this to me, how will i get the data from the SQL server onto the
>page in the first place? will it not need to be an ASP page in order to do
>this - then sort out the client options once its there?
about the client-side functions, not getting the results from the
database on the server side.
You're new to ASP, and need to understand that an ASP "page" may have
server-side and client-side code, as well as HTML coding, DHTML and
quite possibly a Perl script tacked in for good measure. Just because
you use ASP and the problem appears on the page doesn't mean it's an
ASP issue. Heck, it could be a router, DNS, IIS, authentication, NTFS
permissions or Internet Explorer issue. Each technology has some very
talented people voluntarily helping, but none of us know it all. So
we point you to the best place to resolve your issue.
We don't hate you for it, even though we may sound snotty (answering
the same request a dozen times in a day makes us that way), our real
goal is actually getting you working correctly. If we can also give
you the knowledge to figure it out yourself the next time, even
better.
Jeff
>If this is incorrect forgive me, as i stated i am new to ASP and its
>sisters.
>
>Please forgive me, as i feel your response was kind of patronising, i
>appreciate what you guys do as i frequently answer questions in the Exchange
>newsgroups, but your post was simply a point being made rather than helping
>me with my query.
>Whether client or server side the operation still contains ASP at some
>stage, making this post not so as in-appapropriate as you make out.
>
>I will post to the apropriate newsgroups, my apologies to any other MVP with
>their knickers in a twist,
>
>Kind Regards
>
>Guy Hocking
>MCSE
>
>
>
>"Bob Barrows" <reb01501@NOyahoo.SPAMcom> wrote in message
>news:#wgIJyd1DHA.3140@tk2msftngp13.phx.gbl...>web>> Guy Hocking wrote:>>>> > Hi there,
>> >
>> > I am having a few problems compiling a list box that is conditional
>> > on what is selected in another list box.
>> > What i need is a List box (lstArea) that displays one thing when the
>> > List Box (lstRegion) is selected East or West. Basically the areas
>> > will change when East or West is selected in lstRegion.
>> >
>> > The data comes from an SQL Server view, and my current non-working
>> > code is as follows, my syntax in the SQL statement is completly
>> > wrong, i have no idea how to go about this..
>> > The View has 2 columns, vchrLong_Desc and vchrArea_Name, i want the
>> > new list box (lstArea) to display vchrArea_Name when the List Box
>> > lstRegion displays vchrLong_Desc.
>> >
>> [url]http://www.aspfaq.com/show.asp?id=2270[/url]
>>
>> Bob Barrows
>>
>> PS. I realize you are new, so you probably are not aware that you've
>> committed a breach of netiquette here by posting an off-topic question.
>>
>> Just so you know, ASP is server-side technology, ie, it operates on the>usually>> server. By the time the client sees anything in the browser, ASP is>microsoft.public.scripting.vbscript.>> finished. All subsequent operations (such as responding to users' actions:
>> clicking with the mouse or selecting an option in a listbox) are no longer
>> ASP operations, making them off-topic for this newsgroup. The appropriate
>> newsgroups for this type of question (client-side code) are those that
>> contain "dhtml" (dynamic html) in their names, or
>> microsoft.public.scripting.jscript, or>included>> With a few exceptions, questions about activity that occurs on the server
>> (server-side code) before the client sees the response in the browser, are
>> the only on-topic questions for these asp newsgroups. (I notice you>only>> the .iis newsgroup, which was totally inappropriate, since that newsgroup
>> deals with the web server itself). It helps to browse a little in the
>> newsgroups before posting to see which types of questions are deemed
>> appropriate - you may even discover the answer to your question without
>> posting. Use Google to seach for answers before posting: you will save
>> yourself (and us) some time.
>>
>> I do congratulate you for cross-posting instead of multi-posting, however.
>> Nothing burns us up more than responding to a question in one newsgroup>>> to find it's been answered in another group.
>>
>> --
>> Microsoft MVP - ASP/ASP.NET
>> Please reply to the newsgroup. This email account is my spam trap so I
>> don't check it very often. If you must reply off-line, then remove the
>> "NO SPAM"
>>
>>Jeff Cochran Guest
-
Alex G #7
Re: Conditional List Box in ASP
Try these for starters
[url]http://www.4guysfromrolla.com/webtech/101099-1.shtml[/url]
[url]http://www.4guysfromrolla.com/webtech/061399-1.shtml[/url]
[url]http://www.devguru.com/features/knowledge_base/A100209.html[/url]
[url]http://www.aspfree.com/c/a/ASP/Two-dropdown-boxes-that-are-DataBase-Driven/[/url]
"Guy Hocking" <guy.hocking@bradflack.com> wrote in message news:<#AJD5Sd1DHA.2388@TK2MSFTNGP09.phx.gbl>...> Hi there,
>
> I am having a few problems compiling a list box that is conditional on what
> is selected in another list box.
> What i need is a List box (lstArea) that displays one thing when the List
> Box (lstRegion) is selected East or West. Basically the areas will change
> when East or West is selected in lstRegion.
>
> The data comes from an SQL Server view, and my current non-working code is
> as follows, my syntax in the SQL statement is completly wrong, i have no
> idea how to go about this..
> The View has 2 columns, vchrLong_Desc and vchrArea_Name, i want the new list
> box (lstArea) to display vchrArea_Name when the List Box lstRegion displays
> vchrLong_Desc.
>
> ************************
> <select name="lstArea" size="1"><br>
> <option value="">Please Select </option>
> <%
> Dim SQL, RS,
>
> SQL = "SELECT * from vw_SOLS_RegionsAreas_u WHERE
> vw_SOLS_RegionsAreas_u.vchrLong_Desc =" ("lstRegion")""
>
> set RS = DataConnection.Execute(SQL)
> If not RS.EOF then
> while not RS.EOF
> Response.write("<option
> value='"&RS("vchrArea_Name")&"'>"&RS("vchrArea_Nam e")&"</option>")
> RS.movenext()
> wend
> else
> Response.write("")
> end if
> %>
> </select>
> ***************************
>
> Hope that is not too confusing,
> I am new to ASP so you will have to forgive me for being nieve
>
> Thanks in advance
>
> GuyAlex G Guest
-
Guy Hocking #8
Re: Conditional List Box in ASP
Cheers Guys and Gals for your help,
Once again my apologies to those i may of offended.
Keep up the good work ppl
Thanks again
--
Guy
"Alex G" <alex_goodey709@hotmail.com> wrote in message
news:c52476a5.0401080920.3286773f@posting.google.c om...[url]http://www.aspfree.com/c/a/ASP/Two-dropdown-boxes-that-are-DataBase-Driven/[/url]> Try these for starters
>
> [url]http://www.4guysfromrolla.com/webtech/101099-1.shtml[/url]
>
> [url]http://www.4guysfromrolla.com/webtech/061399-1.shtml[/url]
>
> [url]http://www.devguru.com/features/knowledge_base/A100209.html[/url]
>
>news:<#AJD5Sd1DHA.2388@TK2MSFTNGP09.phx.gbl>...>
> "Guy Hocking" <guy.hocking@bradflack.com> wrote in messagewhat> > Hi there,
> >
> > I am having a few problems compiling a list box that is conditional onList> > is selected in another list box.
> > What i need is a List box (lstArea) that displays one thing when thechange> > Box (lstRegion) is selected East or West. Basically the areas willis> > when East or West is selected in lstRegion.
> >
> > The data comes from an SQL Server view, and my current non-working codelist> > as follows, my syntax in the SQL statement is completly wrong, i have no
> > idea how to go about this..
> > The View has 2 columns, vchrLong_Desc and vchrArea_Name, i want the newdisplays> > box (lstArea) to display vchrArea_Name when the List Box lstRegion> > vchrLong_Desc.
> >
> > ************************
> > <select name="lstArea" size="1"><br>
> > <option value="">Please Select </option>
> > <%
> > Dim SQL, RS,
> >
> > SQL = "SELECT * from vw_SOLS_RegionsAreas_u WHERE
> > vw_SOLS_RegionsAreas_u.vchrLong_Desc =" ("lstRegion")""
> >
> > set RS = DataConnection.Execute(SQL)
> > If not RS.EOF then
> > while not RS.EOF
> > Response.write("<option
> > value='"&RS("vchrArea_Name")&"'>"&RS("vchrArea_Nam e")&"</option>")
> > RS.movenext()
> > wend
> > else
> > Response.write("")
> > end if
> > %>
> > </select>
> > ***************************
> >
> > Hope that is not too confusing,
> > I am new to ASP so you will have to forgive me for being nieve
> >
> > Thanks in advance
> >
> > Guy
Guy Hocking Guest
-
Brynn #9
Re: Conditional List Box in ASP
I would suggest using ASP to write out the first select ... then you
will have to use asp to write out the next select for the change in
the first
I would suggest as you explore your javascript needs for this problem,
you make it easy on yourself and look into splitting strings in js
<script language="javascript"
var secondCommaString
switch(valueOfFirstSelectBox)
<%
loop through 1st box variables to get ...
With Response
.Write "case 'firstBoxValue1':" & vbNewLine
.Write "secondCommaString = string of variables for javascript to
use to create an array and create new select bow" & vbNewLine
..Write "break" & vbNewLine
End With
%>
//then later in js split the commaString into a JS array and write
"show" the span and write the 2nd select box with the array of values
Anyway, this is a semi-complex piece of code ... and a little lengthy
for me to put here ...
On Thu, 8 Jan 2004 10:47:17 -0000, "Guy Hocking"
<guy.hocking@bradflack.com> wrote:
>Hi there,
>
>I am having a few problems compiling a list box that is conditional on what
>is selected in another list box.
>What i need is a List box (lstArea) that displays one thing when the List
>Box (lstRegion) is selected East or West. Basically the areas will change
>when East or West is selected in lstRegion.
>
>The data comes from an SQL Server view, and my current non-working code is
>as follows, my syntax in the SQL statement is completly wrong, i have no
>idea how to go about this..
>The View has 2 columns, vchrLong_Desc and vchrArea_Name, i want the new list
>box (lstArea) to display vchrArea_Name when the List Box lstRegion displays
>vchrLong_Desc.
>
>************************
><select name="lstArea" size="1"><br>
><option value="">Please Select </option>
><%
> Dim SQL, RS,
>
> SQL = "SELECT * from vw_SOLS_RegionsAreas_u WHERE
>vw_SOLS_RegionsAreas_u.vchrLong_Desc =" ("lstRegion")""
>
> set RS = DataConnection.Execute(SQL)
> If not RS.EOF then
> while not RS.EOF
> Response.write("<option
>value='"&RS("vchrArea_Name")&"'>"&RS("vchrArea_Na me")&"</option>")
> RS.movenext()
> wend
> else
> Response.write("")
> end if
>%>
></select>
>***************************
>
>Hope that is not too confusing,
>I am new to ASP so you will have to forgive me for being nieve
>
>Thanks in advance
>
>Guy
>
>Brynn Guest



Reply With Quote

