What is the best way to retain textbox focus when a validation fails?
Scenario: Txt1 and Txt2 are next to each other. Both are mandatory fields. When we write code in Txt1 onblur, it fires only after yielding focus to Txt2. This causes a problem because, when we do Txt1.focus from onblur, it fires the Txt2 onblur, which in turn requests focus, thus going into a deadlock situation.
To avoid this, had to go for a dirty flag as in the code snippet below.
Is there a better way? Are there any good events that will work in IE as well as Firefox?
Note: Also tried
return false
inside onblur. Dint work.
Thanks in advance,
Sriram
[ September 10, 2008: Message edited by: sriram viswanathan ]