the document.forms[0].submit() won't populate any hidden fields which is what he wanted to do. Now WHY he wanted to do that I don't know. You are correct that you could could just capture the value of the select field in the action page and not have a hidden field. The other thing to make my code much simpler is to use selectedIndex instead of looping but old habits die hard.
----- Original Message ----- From: "Ron Hornbaker" <[EMAIL PROTECTED]> To: "CF-Talk" <[EMAIL PROTECTED]> Sent: Tuesday, November 27, 2001 1:01 PM Subject: RE: Ok.. JS gurus... > Great bit of code, but of course all that is unnecessary if all Lee wants > to do is capture the value of the select field: > > <select name=blah onChange="document.forms[0].submit();"> > > And if supporting older browsers/JS-disabled browsers is important, > putting this after the </select> tag is a good idea: > > <noscript> > <input type=submit value=Go> > </noscript> > > -Ron > > > �_�.���) http://www.BookCrossing.com ~ Read and Release! (�`�.�_�. > > > > > > > -----Original Message----- > > From: Don Vawter [mailto:[EMAIL PROTECTED]] > > Sent: Tuesday, November 27, 2001 1:55 PM > > To: CF-Talk > > Subject: Re: Ok.. JS gurus... > > > > > > I assume you mean populate a hidden field rather than create a > > hidden field > > correct? > > > > <select name="blah" onChange="foobar(this);"> > > > > function foobar(obj){ > > with (obj){ > > for(i=0;i<options.length;i++){ > > if(options[i].selected){ > > document.forms[0].hiddenfield.value=options[i].value; > > break; > > } > > } > > } > > document.forms[0].submit(); > > } > > > > I haven't tested this but I think it should work > > > > ----- Original Message ----- > > From: "Lee Fuller" <[EMAIL PROTECTED]> > > To: "CF-Talk" <[EMAIL PROTECTED]> > > Sent: Tuesday, November 27, 2001 12:35 PM > > Subject: OT: Ok.. JS gurus... > > > > > > > Since we seem to be on the subject, I can't get anything to work, and > > > thought someone (prolly Dave <grin>) might have an answer for this... > > > > > > Need to include a drop-down in a form that, when changed (onchange), > > > will add a hidden field to the form, and submit it immediately. > > > > > > Send me somewhere to find it.. That's ok! ;) Just need to figure it > > > out. > > > > > > TTAIA > > > > > > Lee > > > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/[email protected]/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

