Opened 14 years ago

Closed 14 years ago

Last modified 14 years ago

#6280 closed defect (fixed)

Unable to prevent form submit

Reported by: guest Owned by: alex
Priority: high Milestone: 1.1
Component: Dijit Version: 1.1b1
Keywords: form submit Cc: bill
Blocked By: Blocking:


I am unable to prevent the form submit process on IE7 only. It works fine on ie6, firefox. Problem seen with 1.1b3 and 1.1rc1

 <form dojoType="dijit.form.Form" id="myForm" onSubmit="return false;">

       <input id="idSearch" type="text" dojotype="dijit.form.TextBox" name="line" style="width: 12em" trim="true"  />
          <button dojoType="dijit.form.Button"   type="submit">
	No submit 

Change History (8)

comment:1 Changed 14 years ago by Douglas Hays

Milestone: 1.1
Owner: set to Douglas Hays
Version: 1.1b1

regression in [12067]

comment:2 Changed 14 years ago by Douglas Hays

Cc: bill added
Owner: changed from Douglas Hays to alex
Priority: normalhigh

Sorry, about the prior post but I was only looking at dijit changes before.
If I take the current trunk and roll back only dojo/_base/html.js to [12893] then it works. Probably the ability of dojo.attr to handle value types of function is broken.

comment:3 Changed 14 years ago by Douglas Hays

severity: majorblocker

Run dijit/demos/form.html on any browser
Press OK. Press Cancel to not submit the form, but the submit proceeds.

comment:4 Changed 14 years ago by Douglas Hays

Keywords: ie7 removed
Summary: Unable to prevent form submit ie7 onlyUnable to prevent form submit

dojo.attr was changed in revision [12899] to use connect for function values. But this doesn't work for functions like onsubmit and onreset that have to return a boolean that tell the browser whether to proceed or not. There may be other functions that work the same as well (onclick?).

comment:5 Changed 14 years ago by bill

See also #6292, a dup of this.

comment:6 Changed 14 years ago by alex

doughays: using dojo.connect() for those events allows us to handle cancelation in a uniform way. The preferred syntax for the above is:

 <form dojoType="dijit.form.Form" id="myForm" onSubmit="dojo.stopEvent(arguments[0]);">

Which will call dojo.stopEvent() on the passed event object on all browsers which I've tested on. I'll update the docs on dojo.attr()'s behavior and also add a test cage for this use-case, but fundamentally it's not a bug.


comment:7 Changed 14 years ago by alex

Resolution: fixed
Status: newclosed

(In [13181]) update docs and default behavior for dijit.Form and dojo.attr to make it crystal clear that unified Dojo event handling is in play when using event handlers specified by dojo.attr() and that browser-specific hacks may no longer work as expected. Fixes #6280. !strict

comment:8 Changed 14 years ago by bill

(In [13191]) Patch from Doug to make onsubmit="return false;" work on dijit.Form (in addition to dojo.stopEvent()), like on native <form> elements. Fixes #6299, refs #6280, #6292.

Note: See TracTickets for help on using tickets.