Hi,
I have a form that displays data from the database. In this form I have a field that is a dropdown list:
Code:
<div id='subform_grade_udetails0026l332t598' style='position:absolute;top:598px;left:332px'>
<select name="subform_grade_udetails0026udetails_cos" id="subform_grade_udetails0026udetails_cos" class="objects" style="width:80px;" onchange="untick('subform_grade_udetails0026', this);uDB(this);calcStatus();" onfocus="nuSetRow('subform_grade_udetails0026');" >
<option value=''></option>
<option value='Failed'>Failed</option>
<option value='Passed'>Passed</option>
</select>
</div>
Using javascript I'm trying to set the option 'Failed' to "selected".
I have tried to use:
Code:
setSelectedIndex(document.getElementById('subform_grade_udetails0026udetails_cos'),"Failed");
function setSelectedIndex(s, v) {
for ( var i = 0; i < s.options.length; i++ ) {
if ( s.options[i].text == v ) {
s.options[i].selected = true;
return;
}
}
}
It seen that the dropdown box is filled with "Failed". When I save fields are getting blank.
In the code I see that the "Failed" option is not "Selected" and I don't understand why.
Could you please help me with this?
Thank You!
RESA