I know that the onsubmit event occurs when a form is submitted.
Generally what we do is, we are calling a method on onsubmit event like <form action="" onsubmit="myfunction()">
Today I saw this, "<form action="" onsubmit="return false">". How it works? I could not understand what is the meaning of onsubmit="return false".
PS : I found this when I learning Ajax. It was a tutorial which explains how to submit data to database without refresh the page.
For example - for validation purpose See below code and see how it can be beneficial:
If you are using button instead of submit as in my case below.
<FORM NAME="myForm" onSubmit="myFunctionName(); return false"> <INPUT TYPE="TEXT" NAME="myText"> <INPUT TYPE="button" VALUE="Click Me" onclick="myFunctionName()"> </FORM>