Hi All,
I am new to php. The form that i am designing has few input input fields with submit and reset button. The functionality of submit and reset are working properly till now.
My form
<form name="search" id="search" action= "search.php" method = "post" onreset="formReset(this);return false;">
<table cellspacing="1" cellpadding="1" >
<tr> <!-- Input field for responsible-->
<td width="200" > <b> Responsible: </b> </td>
<td> <select name="responsible[]"
id="responsible[]" multiple="multiple">
<option value="" > </option>
<option value="ALL"> ALL </option>
<?php
$subject_set = get_all_subjects();
$subject_count = odbc_num_rows($subject_set);
while ($subject = odbc_fetch_array($subject_set)) {
echo "<option value=\"{$subject['menu_name']}\"";
if($responsible) {if(in_array($subject['menu_name'],$responsible)) { echo " selected"; }}
echo ">{$subject['menu_name']}</option>";
}
?>
</select>
</td>
</tr>
</tbody>
</table>
</form>
and javascript - 'formReset' that i am calling was
function formReset(frm) {
for(var i=0;i<frm.elements.length;i++){
if(!(frm.elements[i].type && frm.elements[i].type == "submit") &&
!(frm.elements[i].type && frm.elements[i].type == "reset") &&
!(frm.elements[i].type && frm.elements[i].type == "button"))
frm.elements[i].value = "";
if (frm.elements[i].type == 'radio' && frm.elements[i].checked == true) {
frm.elements[i].checked = false;
}
}
It is working perfectly. The only change i made in the form was to add multiple="multiple" feature for the select tag. Now on click reset it is restoring the previous values. It is not resetting the selected values. I checked the same in Firefox it working as desired(reset the multiple selected values) but not in IE. I have been banging my head since morning.I have a deliverable for tomorrow. So please help me