We've expanded our news coverage and improved our search! Visit
oreilly.com for the latest or search for all things across O'Reilly!
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.
|