How to get the value of a form element : Drop downs and lists
This article is in continuation of getting form element values using JavaScript series. Drop down list We can obtain a reference to this type of element using its name: oSelectOne = oForm.elements["select_one_element_name"]; To get the index of the selected option in the JavaScript options array of the select element, we can use the selectedIndex property of the select element object: index = oSelectOne.selectedIndex; We can now use this index to determine the value of the selected option:
How to get the value of a form element using JavaScript
Please refer article: how to get JavaScript form object for information on getting a reference to the form object. In this article we demonstrate the use of JavaScript for accessing the values of form elements. Later, we will demonstrate all the concepts using a real world example. Text input element To obtain a reference to a text input element, here is some sample code: oText = oForm.elements["text_element_name"]; OR oText = oForm.