jQuery in Action, 3rd edition
The moose likes HTML, CSS and JavaScript and the fly likes onBlur problem? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "onBlur problem?" Watch "onBlur problem?" New topic

onBlur problem?

Santana Iyer
Ranch Hand

Joined: Jun 13, 2005
Posts: 335
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

Joined: Nov 08, 2001
Posts: 15385
That is why I would never use onblur to force validation. You can get users stuck in loops.

I agree. Here's the link: http://aspose.com/file-tools
subject: onBlur problem?
jQuery in Action, 3rd edition