I have a form. And an text box inside it. I wrote validation for onchange event to the text xox and same validation at the time of submission. When I change that value and hit enter first it checks the onChange validation and again onsubmit validation. How can I stop after the onChange validation. I used event.stopPropagation , window.event.cancelBubble = true but it din't worked? Ant ideas or suggestion how to handle it.
Asked
Active
Viewed 1,053 times
3 Answers
3
How about trying this:
return false;
?

qwertymk
- 34,200
- 28
- 121
- 184
-
wow it works, I feel so stupid. I tried everything except this. Thanks a lot – tapps Apr 29 '11 at 22:46
0
use this code to stop after onchange:
yourValidationScript()
must return boolean true
or flase
onchange="return yourValidationScript(); submit()"
if yourValidationScript returned false, the script will stop, else it will submit..

danniel
- 1,751
- 1
- 11
- 13