This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

retain textbox focus  RSS feed

 
sriram viswanathan
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66205
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"sriram", please check your private messages for an important administrative matter.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!