Hello:
I need to obtain the text value of the select list instead of its numeric value.
<select name="categories[]" class="categories" ><option value="0">--Select One--</option><option value="2">BRAKE SYSTEMS</option>.....</select>
Based on the code above, I need to be get text Value "BRAKE SYSTEMS: rather than "2". Making the value equal to the text value is not an option.
Furthermore, this select box is part of a pair of select elements with onchange event handlers to give them a cascading behaviour. So, my php to get the text value of the selected option needs to be programmatic. On form submission, there maybe multiple selections.
I found the following code in the web, which I thought maybe able to help, but I'm unable to get it to work.
function doSubmit(oFrm){
var sel;
for (var i=1; i<=4; i++){
sel = oFrm["Select"+i];
if (sel.options[sel.selectedIndex].value!=""){
sel.options[sel.selectedIndex].value = sel.options[sel.selectedIndex].text;
}
}
return true;
}
May I ask for some guidance?
Best,