A Simpler Ajax Path
Subject:   select-one in formData2QueryString
Date:   2005-11-16 08:09:05
From:   inthe80s
While the code provided will work fine in a decent browser like Firefox, Internet Explorer still requires you to pull the index and refer to the text and not just pull the value of the form element. So remove case 'select-one' from the switch, and add it back as a seperate one here:

case 'select-one':
strSubmitContent += + '=' + escape(formElem[formElem.selectedIndex].text) + '&'
Full Threads Oldest First

Showing messages 1 through 1 of 1.

  • select-one in formData2QueryString
    2005-12-16 10:04:33  brucehodo [View]

    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 += + '=' + 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.