Forums
This topic is locked
ASP Forms and Linking Dynamic list boxes
Posted 29 Mar 2006 16:57:30
1
has voted
29 Mar 2006 16:57:30 Simon James posted:
I apologise if this is a very simple request.I have a form with a User Name field on it. This is being retrieved from a database table. In the database I have a unique ID for that user name.
When I select a User Name from the list I want a hidden field "userid" to contain the appropriate unique ID.
ie
Table User
User Name Unique ID
Simon James 36
Peter Pervis 37
Harry Potter 38
If I chose Harry Potter in the dropdown box I would want the "userid" = 38
I can only seem to do this for the first value in the list !!!
Can anyone help.
Thanks Simon
Replies
Replied 29 Mar 2006 17:29:03
29 Mar 2006 17:29:03 Simon Bloodworth replied:
How are you associating the data to the hidden field?
Is the hidden field on the same page as your list box?
Simon
DWMX 2004 | ASP | VBScript
Is the hidden field on the same page as your list box?
Simon
DWMX 2004 | ASP | VBScript
Replied 29 Mar 2006 17:47:14
29 Mar 2006 17:47:14 Simon James replied:
I think that is the problem. The link between Harry Potter and 38 only comes from the database.
The hidden field is going to be on the same page.
Thanks for taking an interest.
Simon
The hidden field is going to be on the same page.
Thanks for taking an interest.
Simon
Replied 29 Mar 2006 17:55:54
29 Mar 2006 17:55:54 Simon Bloodworth replied:
Well i'd do something like this:
have the selection submit to the same page and have your hidden field set to this:
request.form("name-goes-here"
You hidden field should then be set to that value and allow you to then use that however you wish.
Simon
DWMX 2004 | ASP | VBScript
have the selection submit to the same page and have your hidden field set to this:
request.form("name-goes-here"
You hidden field should then be set to that value and allow you to then use that however you wish.
Simon
DWMX 2004 | ASP | VBScript
Replied 02 Apr 2006 10:25:30
02 Apr 2006 10:25:30 micah santos replied:
<form method="post" action="yourform.asp">
<SELECT name="category">
<%
Dim unique_Id,vwName
Do until objRs.EOF
unique_Id = objRs("ID"
vwName = objRs("USERNAME"
response.write"<OPTION value='" & unique_Id & "'>" & vwName & "</OPTION">
objRs.EOF
Loop
objRs.Close
Set objRs = Nothing
%>
</SELECT>
<INPUT Type="sumbit" value="View">
</form>
<SELECT name="category">
<%
Dim unique_Id,vwName
Do until objRs.EOF
unique_Id = objRs("ID"
vwName = objRs("USERNAME"
response.write"<OPTION value='" & unique_Id & "'>" & vwName & "</OPTION">
objRs.EOF
Loop
objRs.Close
Set objRs = Nothing
%>
</SELECT>
<INPUT Type="sumbit" value="View">
</form>