ONJava.com -- The Independent Source for Enterprise Java
oreilly.comSafari Books Online.Conferences.

advertisement

AddThis Social Bookmark Button
Article:
  A Simpler Ajax Path
Subject:   select-one in formData2QueryString
Date:   2005-12-16 10:04:33
From:   brucehodo
Response to: select-one in formData2QueryString

If my understanding of how SELECT's work is correct, you have to refer to the selected OPTION of the SELECT to get the actual value that would be returned in a form submission.


Using the above example:


strSubmitContent += formElem.name + '=' + escape(formElem.options[formElem.selectedIndex].text) + '&'


will return the label of the selected option. Substituting "value" for "text" will return the assigned value of the selected option.