Re: event handler problem in large complex form
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.javascript archive

Re: event handler problem in large complex form

From: Arthur Rusdell-Wilson <arthur@kitekonsultants.co.uk>
Date: Fri Jul 15 2005 - 08:41:55 CEST

The problems you identify were not those that I had. I believe VK has the
answer, see my reply to his.

-- 
Arthur, on behalf of Kite Konsultants
"Grant Wagner" <gwagner@agricoreunited.com> wrote in message
news:0mSAe.45$va3.513@news2.mts.net...
> "Arthur Rusdell-Wilson" <arthur@kitekonsultants.co.uk> wrote in message
> news:db0ov6$mql$1$8302bc10@news.demon.co.uk...
> >I find that in a large form (especially if there is a table within the
> > form?) that the form is submitted to my server-side script even when a
> > JavaScript 'onsubmit' event handler returns 'false'.
> >
> > does any one else have this problem, and is there a work-round?
> >
> > -- 
> > Arthur Rusdell-Wilson
>
> It's likely you aren't returning the value returned from the JavaScript
> function to the event:
>
> <form ... onsubmit="validate(this);">
>
> The above won't ever stop the form submission even if the function is
> defined as:
>
> function validate() { return false; }
>
> In order for the function to prevent form submission, you must return
> the value to the event:
>
> <form ... onsubmit="return validate(this);">
>
> If you have this, and you've verified that false (not "false") is
> actually being returned (using <form ...
> onsubmit="alert(validate(this));">), then it's a browser implementation
> bug and there won't be any work-around short of changing browsers.
>
> I doubt very much it is a browser implementation bug, and instead one of
> the two possibilities I listed:
>
> 1) you aren't returning the value to the event
> 2) you are returning the string "false" instead of the boolean false
>
> -- 
> Grant Wagner <gwagner@agricoreunited.com>
> comp.lang.javascript FAQ - http://jibbering.com/faq
>
>
Received on Tue Oct 18 02:56:15 2005