> I have a <select> field showing the output of a CFQUERY. I 
> want to set up a hidden field to reflect what was selected in 
> the first field. So if the <select> field looks like this:
> 
> <select name="reqUserID" id="reqUserID"> <cfoutput 
> query="listUsers_qry"> <option 
> value="#listUsers_qry.userID#">#listUsers_qry.userLastName#)</option>
> </cfoutput>
> </select>
> 
> ....I'd like a hidden field to reflect what was selected. I'm using 
> the options below unsuccessfully:
> 
> <input type="hidden" name="revUserID" value="#reqUserID#">
> <input type="hidden" name="revUserID" value="#form.reqUserID#">
> 
> What would then be the syntax to transfer/reflect the value of 
> "reqUserId" into "revUserID"?

Presumably, you want to do this in the browser when the user makes the
change, right?

<select ...
onchange="document.forms[0].revUserID.value=this.options[this.selectedIndex]
..value;">

You'll need to get rid of one of the two hidden fields, obviously.

Or, do you mean that you want the same value in the hidden field when the
page loads? In that case, you'd have to refer to whichever value was
selected by default. If none is selected by default, you'd simply reference
the first value from the query:

<input type="hidden" name="revUserID" value="#listUsers_qry.userID[1]#">

The array notation is optional here, since referring to the field outside of
a loop will return the first row's value anyway.

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/

Fig Leaf Software provides the highest caliber vendor-authorized
instruction at our training centers in Washington DC, Atlanta,
Chicago, Baltimore, Northern Virginia, or on-site at your location.
Visit http://training.figleaf.com/ for more information!

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:256351
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to