/    Sign up×
Community /Pin to ProfileBookmark

help with onblur()

hi, how are you? i’d be better if i could figure out a way to solve the following predicament, maybe someone can help…..i have an input txtfld with an entry validation function registered in the onblur event handler. so no matter what happens, when the focus leaves this text field the validation function checks for a valid name. what i want to happen, however, is for this to happen all the time except for when the cancel button is submitted. intuitively, it seems that there is no way to determine if the cancel button has been clicked as onblur executes as soon as the focus leaves the aforementioned text field, which is before the cancel button is registered. can anyone suggest a possible way around this outside of not registering onblur with the text field? thanks

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@tabzterAug 28.2005 — Could you show us exactly what your trying to do? Maybe post some code.

By the way... Its long been known about the curse of the onblur() validation checking. When I was younger I tried it myself and the best advice someone gave me was DONT USE IT.
Copy linkTweet thisAlerts:
@JPnycAug 28.2005 — Well you pretty much answered this yourself. There's no way to stop the function from executing onblur, but you could delay it by putting a setTimeout() into the function call. That way on the cancel button you could put a clearTimeout() and it wouldn't execute at all. But of course it would always delay and there's no way around that. If they don't click cancel fast enough it would still execute. Anyway validation functions really should be called onsubmit of the form tag.
Copy linkTweet thisAlerts:
@intergalacticauthorAug 29.2005 — i'm realizing that this is probablyl a dead end. thanks for the advice though. back to the drawing board!
×

Success!

Help @intergalactic spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...