In the past I have used code that looks something like this ...
<form action="url..." onsubmit="jsfunction()">
where the function would 'return false' if it fails, and would return nothing if valid.
On this board I noted that the correct method should be as follows..
<form action="url..." onsubmit="return jsfunction()">
and the function should return true or false.
Secondly, I've seen, and used, snippets of code like this, sometimes with and sometimes without the return.
... onmouseover="jsfunction(); return true"..
Thirdly, event handlers sometimes return true or false, but not always.
I've read though the javascript documentation and one of the O'Reilly books on javascript and I notice that, again, the 'return'
is sometimes included and somtimes not.
Could someone explain WHEN, and more importantly WHY, a return should be used? Is there a good source to read up on this?
<form action="url..." onsubmit="jsfunction()">
where the function would 'return false' if it fails, and would return nothing if valid.
On this board I noted that the correct method should be as follows..
<form action="url..." onsubmit="return jsfunction()">
and the function should return true or false.
Secondly, I've seen, and used, snippets of code like this, sometimes with and sometimes without the return.
... onmouseover="jsfunction(); return true"..
Thirdly, event handlers sometimes return true or false, but not always.
I've read though the javascript documentation and one of the O'Reilly books on javascript and I notice that, again, the 'return'
is sometimes included and somtimes not.
Could someone explain WHEN, and more importantly WHY, a return should be used? Is there a good source to read up on this?