Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

onBlur problem?

 
Santana Iyer
Ranch Hand
Posts: 335
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have few text boxes, all have same name.

On lost focus I show alert("Please enter value").
and set focus back to same text field.

But what happens is alert box comes continuosly.

I think this is because other control gets focus and loses focus since we say first control.focus but now since second control lost focus with empty value so it also raises alert.

It happens in cycle.
How to solve this problem.
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That is why I would never use onblur to force validation. You can get users stuck in loops.

Eric
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic