[thelist] Strange FF Behavior

Burhan Khalid thelist at meidomus.com
Wed Jul 27 05:47:10 CDT 2005


Hello All:

   I'm using some Ajax-like magic in one of my forms.  I have a link 
that  toggles the display of a div.  In this div, there is a button that 
triggers the javascript -- all this is encapsulated in another form.

   Everything works as expected in IE, but in FF, the button in the 
hidden div triggers a submit of the parent form, not the expected behavior.

   A very simple version of the form is :

   <form method="post" action="somefile.php">
   <input type="text" name="somename" />
   <input type="text" name="someothername" />
   <input type="text" disabled="disabled" name="status" id="status" />

   <span onclick="toggle()">toggle</span>
   <div id="toggle-div">
     <input type="text" name="t-text">
     <button id="updatebtn" onclick="dorequest()">Go</button>
   </div>
   <input type="submit" name="submit" value="Submit" />
   </form>

   Initially, toggle-div is hidden (display:none), and toggle() unhides 
it.  Then dorequest() takes the value of t-text and passes it to the 
javascript function that does the remoting.  When a response is 
returned, toggle-div is hidden, and then "status" is updated with the 
response.

   In IE, this works great, in FF, when I hit the Go button, then entire 
form is submit, as if I clicked on Submit.

   Can anyone give me some pointers here?  I have checked my Javascript 
about 5 times, and it works great in both browsers with a simple form, 
but as soon as I 'nest' them (as above), FF starts acting up.  Using the 
latest FF and IE on Windows.

Thanks,
Burhan


More information about the thelist mailing list