[Javascript] Unobtrusive onsubmit

Terry Riegel riegel at clearimageonline.com
Wed Feb 18 13:03:09 CST 2009


I am working through an unobtrusive bit of javascript and wonder if  
anyone might be able to lend a hand.

  <FORM ACTION="../cgi-bin/mycgi.pl" ID="testform" NAME="testform"  
onSubmit="return TestDataCheck()">

I would like to take this onSubmit out of the form declaration and put  
it in an startup function that runs on load.

So I have this...
document.getElementById('testform').onsubmit=TestDataCheck;
I am not sure of the syntax that would duplicate the return part of  
the obtrusive JS.
I have tried this...
document.getElementById('testform').onsubmit=return TestDataCheck;

How would I get it to invalidate the action of the form and just do  
something else?

Any help will be greatly appreciated.

Terry Riegel



More information about the Javascript mailing list