This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
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: 15376
That is why I would never use onblur to force validation. You can get users stuck in loops.

I agree. Here's the link:
subject: onBlur problem?
Similar Threads
for attribute in Label element
focusing on an input element with jquery
alert msg on onchange event
What type of listener can i use, instead of FocusListener
JTable Column Validation