[Javascript] IE onclick problem

Hassan Schroeder hassan at webtuitive.com
Thu Apr 17 09:42:04 CDT 2008


Cutter (JSRelated) wrote:

> validate function returns true or false, which either cancels the event 
> or allows it depending on that return.

That's simply wrong.

> Create a quick test case:
> 
> function checkMyForm(){
>       return false; // Manually toggle this for your test
> }
> 
> Then make a quick test form with onsubmit="checkMyForm()" to see what 
> happens. 

Yep, easy test case, which demonstrates that the above submits no
matter what happens in the function, while

	onsubmit="return checkMyForm()"

does not (when the returned value is false).

It is certainly possible to have the function "trap" the event (i.e.
cancel bubbling) but your example doesn't do that.

-- 
Hassan Schroeder ----------------------------- hassan at webtuitive.com
Webtuitive Design ===  (+1) 408-621-3445   === http://webtuitive.com

                           dream.  code.



More information about the Javascript mailing list