By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,776 Members | 1,397 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,776 IT Pros & Developers. It's quick & easy.

onblur function interrupting form submission

P: n/a
I'm trying to set up a simple "change your password" form. I've got an
AJAX process that is checking the new password the user enters against
their current password to make sure they're changing it. This function
is firing via the password field's onBlur event handler.

I want to do some other form validation using the form's onSubmit
handler (onSubmit="return validateForm();", and if all those conditions
are met, the form submits.

Problem is, if focus is on that password field and the user attempts to
click the submit button, the onBlur event fires, and after that,
nothing happens. The flow seems to be interrupted - I get no further
activity indicating the click happened. No onFocus for the submit
button, no onClick for that button, no onSubmit events will fire, and
the form does not submit.

How do I continue the process beyond that onBlur function if the user
is trying to click the submit button?

Thanks in advance.

Feb 6 '06 #1
Share this Question
Share on Google+
4 Replies


P: n/a

jo**********@gmail.com wrote:
I'm trying to set up a simple "change your password" form. I've got an
AJAX process that is checking the new password the user enters against
their current password to make sure they're changing it. This function
is firing via the password field's onBlur event handler.
If the user has javascript disabled, what happens then? Do you do any
server-side validation?
I want to do some other form validation using the form's onSubmit
handler (onSubmit="return validateForm();", and if all those conditions
are met, the form submits.

Problem is, if focus is on that password field and the user attempts to
click the submit button, the onBlur event fires, and after that,
nothing happens. The flow seems to be interrupted - I get no further
activity indicating the click happened. No onFocus for the submit
button, no onClick for that button, no onSubmit events will fire, and
the form does not submit.

How do I continue the process beyond that onBlur function if the user
is trying to click the submit button?


Here's a scenario, let's just say that the server is under heavy
traffic, when the user submits the form, will your "AJAX" request come
back fast enough? Instead, I would say to keep your current validation
done through the onsubmit event handler and do the password checking on
the server-side. An even more plus is to do form validation on the
server-side as well, in case the user has turned off javascript.

Feb 6 '06 #2

P: n/a
When the AJAX process begins, I have a "message" area that is changed
to read "checking..." along with an animated spinning hourglass,
windows-mouse-cursor-style.

And yes, I'm doing server-side validation as well.

Yes, you're right, I could do all this server-side. At this point it's
the principle - there's got to be a way to do this, so know I'm curious
what it is.

Feb 6 '06 #3

P: n/a
jo**********@gmail.com said the following on 2/6/2006 5:14 PM:
I'm trying to set up a simple "change your password" form.
Then have one. They are easy.
I've got an AJAX process that is checking the new password
the user enters against their current password to make sure
they're changing it.
That is, without a doubt, the dumbest way to achieve it.
This function is firing via the password field's onBlur event handler.
That is almost, but not quite, dumber than the "AJAX Process".

Use the onchange, not the onblur
I want to do some other form validation using the form's onSubmit
handler (onSubmit="return validateForm();", and if all those conditions
are met, the form submits.
Then do it.
Problem is, if focus is on that password field and the user attempts to
click the submit button, the onBlur event fires, and after that,
nothing happens.
Flaw in your reasoning. Have your magical "AJAX Process" disable the
submit button.....
The flow seems to be interrupted - I get no further
activity indicating the click happened. No onFocus
for the submit button, no onClick for that button, no
onSubmit events will fire, and the form does not submit.
Welcome to the Web.
How do I continue the process beyond that onBlur function if the user
is trying to click the submit button?


Read above.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Feb 6 '06 #4

P: n/a
jo**********@gmail.com said the following on 2/6/2006 5:35 PM:

Please quote what you are replying to.

If you want to post a followup via groups.google.com, don't use the
"Reply" link at the bottom of the article. Click on "show options" at
the top of the article, then click on the "Reply" at the bottom of the
article headers.
When the AJAX process begins,
No, when you *hope* it begins. It may not even be supported (and it's
not in some browsers).
I have a "message" area that is changed
to read "checking..." along with an animated spinning hourglass,
windows-mouse-cursor-style.
Does it have anything in that message about quoting what you are
replying to in Usenet? It should.
And yes, I'm doing server-side validation as well.
As you should - always.
Yes, you're right, I could do all this server-side.
And doing it client-side is nothing but a mere convenience to the user
who decides to allow it to happen.

At this point it's the principle - there's got to be a way to do this,
so know I'm curious what it is.


The Genie in the bottle has the solution. Reply to my other reply to you
and you might get an answer (it is in the other reply).

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Feb 7 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.