473,395 Members | 2,253 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

help me to Reset select tag with multiple options in IE

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
Expand|Select|Wrap|Line Numbers
  1.  
  2.  <form name="search" id="search" action= "search.php" method = "post" onreset="formReset(this);return false;">
  3.  
  4.  <table cellspacing="1" cellpadding="1" >
  5.             <tr>  <!-- Input field for responsible-->
  6.                 <td width="200" > <b> Responsible: </b> </td>
  7.                      <td>  <select name="responsible[]" 
  8.                       id="responsible[]"  multiple="multiple">
  9.                                  <option value="" > </option>
  10.                                 <option value="ALL"> ALL </option>
  11.                                 <?php
  12.                                 $subject_set = get_all_subjects();
  13.                                 $subject_count = odbc_num_rows($subject_set);
  14.                                 while ($subject = odbc_fetch_array($subject_set)) {
  15.                                     echo "<option value=\"{$subject['menu_name']}\"";
  16.                                     if($responsible) {if(in_array($subject['menu_name'],$responsible)) { echo " selected"; }}
  17.                                     echo ">{$subject['menu_name']}</option>";
  18.                                 }
  19.                                 ?>
  20.                             </select>
  21.                         </td>
  22.                     </tr>
  23.               </tbody>
  24.            </table>          
  25.         </form>
and javascript - 'formReset' that i am calling was

Expand|Select|Wrap|Line Numbers
  1.  function formReset(frm) {
  2.     for(var i=0;i<frm.elements.length;i++){
  3.         if(!(frm.elements[i].type && frm.elements[i].type == "submit") &&
  4.             !(frm.elements[i].type && frm.elements[i].type == "reset") &&
  5.             !(frm.elements[i].type && frm.elements[i].type == "button"))
  6.             frm.elements[i].value = "";
  7.         if (frm.elements[i].type == 'radio' && frm.elements[i].checked == true) {
  8.             frm.elements[i].checked = false;
  9.  
  10.         }
  11.     }                  
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
Dec 17 '09 #1
2 2760
Atli
5,058 Expert 4TB
Hey.

Could you post the HTML that is being generated and sent to the browser, rather than the PHP code? We can't really recreate the problem using the PHP code alone, because we don't have the options your code is using.

P.S.
Seeing as this is more about the HTML/JavaScript then the PHP code, I've moved the thread to the JavaScript forums.
Dec 17 '09 #2
acoder
16,027 Expert Mod 8TB
With the multiple select element, you will need to loop over the options and set each one to false. So in your reset function, check for the select type and code accordingly.
Dec 22 '09 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Richard | last post by:
**** Post for FREE via your newsreader at post.usenet.com **** HI, I am working on a project where I need to input data to a (local) HTML page using multiple form elements, such as text,...
8
by: asd | last post by:
I need to find the value/index of the previously selected item of a select list. That is, when the user selects an item from the list and a certain condition elsewhere in the form is not met, I...
3
by: Tony Kim | last post by:
Hi everyone, i have an assignment that needs immediate attention and was hoping i would be able to get some help here. im trying to create 3 option boxes that are linked together. for...
6
by: google | last post by:
Hi, is it possible to reset a SELECT-Tag to it's default value but not reset all other form fields? Here's an example: <select id="myselect" name="myselect"> <option> value1 </option>...
1
by: Rahul | last post by:
Hi Everybody I have some problem in my script. please help me. This is script file. I have one *.inq file. I want run this script in XML files. But this script errors shows . If u want i am...
36
by: Jules | last post by:
All, how do I describe a string consisting of any number of characters, with an optional (but unique when occuring) end-of-line expression '/'? With groups if possible, as in...
0
by: gunimpi | last post by:
http://www.vbforums.com/showthread.php?p=2745431#post2745431 ******************************************************** VB6 OR VBA & Webbrowser DOM Tiny $50 Mini Project Programmer help wanted...
1
Wiccadwitch
by: Wiccadwitch | last post by:
Could someone please help??? I'm using paypal's shopping cart which allows for 2 options (such as colors or sizes). I need up to six options with 40 or so colors to choose from. I tried adding 6...
1
by: deepaks85 | last post by:
Dear All, I want to send some data through a form with Multiple attachment in an HTML Format. I have tried it but it is not working for me. I am able to send data without attachment but with the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.