"Arthur Rusdell-Wilson" <ar****@kitekonsultants.co.uk> wrote in message
news:db*******************@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 <gw*****@agricoreunited.com>
comp.lang.javascript FAQ -
http://jibbering.com/faq