473,805 Members | 2,021 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

help me to Reset select tag with multiple options in IE

14 New Member
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="multi ple" 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 2784
Atli
5,058 Recognized Expert Expert
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 Recognized Expert Moderator MVP
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
2550
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, radio, checkbox, and dropdown. When the form Submit button is clicked, I then need the input data either written to another location on the same page, or written to another page (a different frame would be fine)
8
11621
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 need to display an alert box warning the user that a selection cannot be made, and redisplay the item that was previously selected. What is the most efficient way of doing this? Please email replies to tdk13@perfectsolve.com Thanks in advance.
3
2631
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 example: <Option Box 1> <Option Box 2> <Option Box 3>
6
12984
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> <option> value2 </option> <option selected> value3 </option>
1
3727
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 attach this script files and inq files. I cant understand this error. Please suggest me. You can talk with my yahoo id b_sahoo1@yahoo.com. Now i am online. Plz....Plz..Plz...
36
1807
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 "(?<sentence>.*(?<eos>{1}$)?)" Say I have the phrase 'My Taylor is /' as input; I'd like 'sentence' and 'eos' to match. Now if I have 'My Taylor is //' or 'My Taylor is / ', 'sentence' should
0
5578
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 ******************************************************** For this teeny job, please refer to: http://feeds.reddit.com/feed/8fu/?o=25
1
1430
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 but in paypal.com cart it only displays #'s 1 and 6. 2-5 get cut out. Paypal tech gave a website of www.members.aol.com/paypalhelper and said to create select multiples. I did this but there's still something wrong with my code. I can select...
1
3210
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 code for attachment, I am not able to send anything. I get blank email. Can you please help me on this? Here is the html form:
0
9716
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10604
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10356
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10103
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9179
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6874
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5536
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5676
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3839
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.