1

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.

tapps
  • 51
  • 2
  • 11

3 Answers3

3

How about trying this:

return false;

?

qwertymk
  • 34,200
  • 28
  • 121
  • 184
0

You may try something like

event.stopPropagation()

Found it here

Community
  • 1
  • 1
Mr_Nizzle
  • 6,644
  • 12
  • 55
  • 85
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