0

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

2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by me655321
0

Attempted to recreate what you're seeing in IE8 and can't get a problem..seems to work. Maybe try using selectedIndex=-1 instead of value="" for the select.

Btw not really a php question.

Edited by me655321: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.