Ask a Question related to ASP Database, Design and Development.
-
PiGei #1
Dinamic menu form selection - please help
Hi all,
my problem is the same:
I populate a selection menu in a form with values from an access db and
tht's OK in the sense that my selection works fine.
The problem is that I don't know how to set another field of the form
with a value depending on my first selection.
I mean, with the first menu selection I get from a db id and name, then
I display the menu with all the names.
How can I, if a name is selected, set a variable with the id associated
to that name and insert it in a hidden field of the form?
Below my code for the menu... I tried some things without success.
THX in advance
PGei
<td><font face="Arial"><% x_idgara = 0 'set default value %><%
x_idgaraList = "<SELECT name='x_idgara'><OPTION value=''>Please
Select</OPTION>"
sqlwrk = "SELECT [id], [name] FROM [tbl_games]"
Set rswrk = Server.CreateObject("ADODB.Recordset")
rswrk.Open sqlwrk, conn, 1, 2
If Not rswrk.EOF Then
datawrk = rswrk.GetRows
rowswrk = UBound(datawrk, 2)
For rowcntwrk = 0 To rowswrk
x_idgaraList = x_idgaraList & "<OPTION value='" & datawrk(0,
rowcntwrk) & "'"
If datawrk(0, rowcntwrk) = x_idgara Then
x_idgaraList = x_idgaraList & " selected"
End If
x_idgaraList = x_idgaraList & ">" & datawrk(1, rowcntwrk) &
"</option>"
Next
End If
rswrk.Close
Set rswrk = Nothing
x_idgaraList = x_idgaraList & "</SELECT>"
response.write x_idgaraList
%></font> </td>
PiGei Guest
-
Placing a variable containing a Menu selection inside aspecific Cell of a datagrid
i have a function that gets the menu selection and then places the cursor into the specific field i want to insert the record into; and once in the... -
How do I put a Menu selection into a specific cell of adatagrid...
i have a function that gets the menu selection and then places the cursor into the specific field i want to insert the record into; and once in the... -
Taking Action on Dynamic Menu Selection
:embarrassment; How do i get an action to take place when a menu item is selected from a dynamic menu? I want to move to a specific record item in... -
Making a selection in List Menu
Hey all, I have a multiple list item that I am passing a variable in to have one of the items selected. What I would like to know is it possible to... -
CS: Font selection menu TOO WIDE! (?!?!)
Hi - I'm having a little low-level annoyance with my font menu - when I choose the pull-down menu from the pallette, the list is about 80% the... -
Jeff Cochran #2
Re: Dinamic menu form selection - please help
On Tue, 10 Feb 2004 13:09:22 +0100, "PiGei"
<james_milanNOSPAM@hotmail.com> wrote:
FAQ:>Hi all,
>my problem is the same:
>
>I populate a selection menu in a form with values from an access db and
>tht's OK in the sense that my selection works fine.
>
>The problem is that I don't know how to set another field of the form
>with a value depending on my first selection.
How do I make one dropdown depend on another?
[url]http://www.aspfaq.com/show.asp?id=2270[/url]
Jeff
>I mean, with the first menu selection I get from a db id and name, then
>I display the menu with all the names.
>How can I, if a name is selected, set a variable with the id associated
>to that name and insert it in a hidden field of the form?
>
>Below my code for the menu... I tried some things without success.
>
>THX in advance
>PGei
>
><td><font face="Arial"><% x_idgara = 0 'set default value %><%
>x_idgaraList = "<SELECT name='x_idgara'><OPTION value=''>Please
>Select</OPTION>"
>sqlwrk = "SELECT [id], [name] FROM [tbl_games]"
>Set rswrk = Server.CreateObject("ADODB.Recordset")
>rswrk.Open sqlwrk, conn, 1, 2
>If Not rswrk.EOF Then
> datawrk = rswrk.GetRows
> rowswrk = UBound(datawrk, 2)
> For rowcntwrk = 0 To rowswrk
> x_idgaraList = x_idgaraList & "<OPTION value='" & datawrk(0,
>rowcntwrk) & "'"
> If datawrk(0, rowcntwrk) = x_idgara Then
> x_idgaraList = x_idgaraList & " selected"
> End If
> x_idgaraList = x_idgaraList & ">" & datawrk(1, rowcntwrk) &
>"</option>"
> Next
>End If
>rswrk.Close
>Set rswrk = Nothing
>x_idgaraList = x_idgaraList & "</SELECT>"
>response.write x_idgaraList
>%></font> </td>
>Jeff Cochran Guest
-
PiGei #3
Re: Dinamic menu form selection - please help
Thanks but I can't find my solution in it.
What I don't understand is "I selected an item then how can I put the
relative id - I got the two with the call to the db - in my variable?
I don't understand the javascript in that examples...
Any tips?
thanks
PGei
"Jeff Cochran" <jcochran.nospam@naplesgov.com> wrote in message
news:4029d7c8.607438961@msnews.microsoft.com...and> On Tue, 10 Feb 2004 13:09:22 +0100, "PiGei"
> <james_milanNOSPAM@hotmail.com> wrote:
>> >Hi all,
> >my problem is the same:
> >
> >I populate a selection menu in a form with values from an access dbthen>> >tht's OK in the sense that my selection works fine.
> >
> >The problem is that I don't know how to set another field of the form
> >with a value depending on my first selection.
> FAQ:
>
> How do I make one dropdown depend on another?
> [url]http://www.aspfaq.com/show.asp?id=2270[/url]
>
> Jeff
>
>> >I mean, with the first menu selection I get from a db id and name,associated> >I display the menu with all the names.
> >How can I, if a name is selected, set a variable with the id>> >to that name and insert it in a hidden field of the form?
> >
> >Below my code for the menu... I tried some things without success.
> >
> >THX in advance
> >PGei
> >
> ><td><font face="Arial"><% x_idgara = 0 'set default value %><%
> >x_idgaraList = "<SELECT name='x_idgara'><OPTION value=''>Please
> >Select</OPTION>"
> >sqlwrk = "SELECT [id], [name] FROM [tbl_games]"
> >Set rswrk = Server.CreateObject("ADODB.Recordset")
> >rswrk.Open sqlwrk, conn, 1, 2
> >If Not rswrk.EOF Then
> > datawrk = rswrk.GetRows
> > rowswrk = UBound(datawrk, 2)
> > For rowcntwrk = 0 To rowswrk
> > x_idgaraList = x_idgaraList & "<OPTION value='" & datawrk(0,
> >rowcntwrk) & "'"
> > If datawrk(0, rowcntwrk) = x_idgara Then
> > x_idgaraList = x_idgaraList & " selected"
> > End If
> > x_idgaraList = x_idgaraList & ">" & datawrk(1, rowcntwrk) &
> >"</option>"
> > Next
> >End If
> >rswrk.Close
> >Set rswrk = Nothing
> >x_idgaraList = x_idgaraList & "</SELECT>"
> >response.write x_idgaraList
> >%></font> </td>
> >
PiGei Guest
-
Jeff Cochran #4
Re: Dinamic menu form selection - please help
On Tue, 10 Feb 2004 15:28:42 +0100, "PiGei"
<james_milanNOSPAM@hotmail.com> wrote:
There are two approaches to this, client side and server side. Client>Thanks but I can't find my solution in it.
>What I don't understand is "I selected an item then how can I put the
>relative id - I got the two with the call to the db - in my variable?
side requires no extra trips to the server, but pulls more data
across. Server side, each time a drop-down list item is selected, a
query to the server returns the next set of possibilities. The
examples list client-side options, since that's normally the best for
performance and other reasons.
Can't help you much there, but a Javascript newsgroup would likely be>I don't understand the javascript in that examples...
able to. The Javascript is pretty straightforward, but you do need at
least a base working knowledge to understand what to change.
Jeff
>"Jeff Cochran" <jcochran.nospam@naplesgov.com> wrote in message
>news:4029d7c8.607438961@msnews.microsoft.com...>and>> On Tue, 10 Feb 2004 13:09:22 +0100, "PiGei"
>> <james_milanNOSPAM@hotmail.com> wrote:
>>>> >Hi all,
>> >my problem is the same:
>> >
>> >I populate a selection menu in a form with values from an access db>then>>>> >tht's OK in the sense that my selection works fine.
>> >
>> >The problem is that I don't know how to set another field of the form
>> >with a value depending on my first selection.
>> FAQ:
>>
>> How do I make one dropdown depend on another?
>> [url]http://www.aspfaq.com/show.asp?id=2270[/url]
>>
>> Jeff
>>
>>>> >I mean, with the first menu selection I get from a db id and name,>associated>> >I display the menu with all the names.
>> >How can I, if a name is selected, set a variable with the id>>>>> >to that name and insert it in a hidden field of the form?
>> >
>> >Below my code for the menu... I tried some things without success.
>> >
>> >THX in advance
>> >PGei
>> >
>> ><td><font face="Arial"><% x_idgara = 0 'set default value %><%
>> >x_idgaraList = "<SELECT name='x_idgara'><OPTION value=''>Please
>> >Select</OPTION>"
>> >sqlwrk = "SELECT [id], [name] FROM [tbl_games]"
>> >Set rswrk = Server.CreateObject("ADODB.Recordset")
>> >rswrk.Open sqlwrk, conn, 1, 2
>> >If Not rswrk.EOF Then
>> > datawrk = rswrk.GetRows
>> > rowswrk = UBound(datawrk, 2)
>> > For rowcntwrk = 0 To rowswrk
>> > x_idgaraList = x_idgaraList & "<OPTION value='" & datawrk(0,
>> >rowcntwrk) & "'"
>> > If datawrk(0, rowcntwrk) = x_idgara Then
>> > x_idgaraList = x_idgaraList & " selected"
>> > End If
>> > x_idgaraList = x_idgaraList & ">" & datawrk(1, rowcntwrk) &
>> >"</option>"
>> > Next
>> >End If
>> >rswrk.Close
>> >Set rswrk = Nothing
>> >x_idgaraList = x_idgaraList & "</SELECT>"
>> >response.write x_idgaraList
>> >%></font> </td>
>> >Jeff Cochran Guest
-
Greg Griffiths #5
Re: Dinamic menu form selection - please help
Check out
[url]http://www.greggriffiths.org/webdev/clientside/javascript/linkeddropdowns/[/url]
for some client side that will do this for you, at present it simply
populates another dropdown list, but if you wnat it to populate a textbox
or similar you should be able to amend the code.
PiGei wrote:
> Hi all,
> my problem is the same:
>
> I populate a selection menu in a form with values from an access db and
> tht's OK in the sense that my selection works fine.
>
> The problem is that I don't know how to set another field of the form
> with a value depending on my first selection.
>
> I mean, with the first menu selection I get from a db id and name, then
> I display the menu with all the names.
> How can I, if a name is selected, set a variable with the id associated
> to that name and insert it in a hidden field of the form?
>
> Below my code for the menu... I tried some things without success.
>
> THX in advance
> PGei
>
> <td><font face="Arial"><% x_idgara = 0 'set default value %><%
> x_idgaraList = "<SELECT name='x_idgara'><OPTION value=''>Please
> Select</OPTION>"
> sqlwrk = "SELECT [id], [name] FROM [tbl_games]"
> Set rswrk = Server.CreateObject("ADODB.Recordset")
> rswrk.Open sqlwrk, conn, 1, 2
> If Not rswrk.EOF Then
> datawrk = rswrk.GetRows
> rowswrk = UBound(datawrk, 2)
> For rowcntwrk = 0 To rowswrk
> x_idgaraList = x_idgaraList & "<OPTION value='" & datawrk(0,
> rowcntwrk) & "'"
> If datawrk(0, rowcntwrk) = x_idgara Then
> x_idgaraList = x_idgaraList & " selected"
> End If
> x_idgaraList = x_idgaraList & ">" & datawrk(1, rowcntwrk) &
> "</option>"
> Next
> End If
> rswrk.Close
> Set rswrk = Nothing
> x_idgaraList = x_idgaraList & "</SELECT>"
> response.write x_idgaraList
> %></font> </td>Greg Griffiths Guest



Reply With Quote

