Combining OnSubmit with POST

liunx

Guest
I'm trying to understand some HTML and am stuck on the following line:<br />
<br />
<form name="sendtextform" action="/webOriginate/action/sendMessage" onSubmit="return validate()" method="post"><br />
<br />
The JavaScript validate() function returns either true or false.<br />
<br />
What I don't get is what happens on submit. Is the validate function called followed by the post, or do they happen together? Is there some dependency between them?<br />
<br />
Thanks for all comments.<!--content-->What will happen when you submit is this: It will run the function named validate, and return either true or false. If it returns true, it will submit your form, if it returns false, it will not submit your form.<!--content-->When a "submit" button is called (<input type="submit"> or <button type="submit">some text</button>) the "onsubmit" handler is called and then, unless the handler returns "false", the form is submitted to the address specified by the form's "action" attribute. Note however, that the form also has a "submit" method that submits the form directly, bypassing the "onsubmit" handler.<!--content-->
 
Back
Top