In general, to stop a form from submitting you would need to do two things:
- Place an "onsubmit" event on the form tag
- define the event handler in javascript and return false in that function
So, basically, in HTML you would need:
<form ... onsubmit="return someFunc()">
And in the javascript code you would need:
function someFunc() {
return false;
}
The part with 1 == 2 its for developing purposes only i would imagine, just a mechanism of making the forms to never submit.
When moving on from the developing environment this should be done in a more clever configurable way.
You might as well have a function like this:
function someFunc() {
if (1 > 0) {
return true;
} else {
alert("Not submitting");
return false;
}
}
That validation is only meant to always stop the from from submitting.
Or, a function like this:
function someFunc() {
alert("Not submitting");
return false;
}