[Javascript] IE onclick problem

J. Lester Novros II lester at denhaag.org
Wed Apr 16 20:56:58 CDT 2008


Claude Schneegans wrote:
> <FORM NAME="myForm"....... onsubmit="return checkMyForm()">
> ................
> </FORM>
> <SCRIPT>
> function checkMyForm()
>     {
>     if (<any invalid value in a field>)
>         {
>         alert("There is an invalid value in one field");
>         return false;
>         }
>     return true;
>     }
> </SCRIPT>

Um... At the risk of sounding pedantic, isn't the whole point of this 
thread that one should use return statements in the handler function 
rather than in the event handler itself?

So I would argue that 'onsubmit="return checkMyForm()"' should read 
'onsubmit="checkMyForm()"' since the handler function itself returns a 
true or false value to the onsubmit event, thereby cancelling or granting 
the submit event.

Just my 0.02 Eur.

l8R lES
-- 
"I think a lot more of Apple than I do of MSFT, but then I'd rather catch
rabies than AIDS..."                                           /. comment
                     http://www.supermarionation.tv



More information about the Javascript mailing list