Hello KenGreer and all,
Hm, it seems that I have the same problem. My solution is
even less elegant: I place the focus into the first field
of the form, so the user can't proceed without moving the
focus out. And if he/she moves it out, the validation
obviously passes.
I'll try the async:false method, thanks.
Now I have another problem (I had written about that but got no
answer): if the user presses Ctrl+Enter which is my alternative to
clicking the Sumbit button, the validation doesn't pass and the form
submits nowhere.
How do I resolve that?
Thanks!
--
With best regards from Ukraine,
Andre
Skype: Francophile; Wlm&MSN: arthaelon @ yandex.ru; Jabber: arthaelon @
jabber.org
Yahoo! messenger: andre.polykanine; ICQ: 191749952
Twitter: m_elensule
----- Original message -----
From: KenGreer <[email protected]>
To: jQuery (English) <[email protected]>
Date: Monday, December 21, 2009, 9:15:37 AM
Subject: [jQuery] (validation): remote rule causes submit to abort, fix
included
With the validation plugin (http://bassistance.de/jquery-plugins/
jquery-plugin-validation/) I included two "remote" rules to check
username and e-mail. If my form is loaded such that the username and e-
mail are already filled in, and, therefore, have not yet been
validated, and I click SUBMIT, validation proceeds just fine, but the
form does NOT submit! A second click of the submit button, however,
then works.
I speculated that this was because of pending ajax calls aborting the
submit. It seems my speculation held true. Right after my "$
(document).ready(function() { ..." I added the code:
$.ajaxSetup( {
async: false
} );
to make the "remote" ajax calls synchronous and this fixed the
problem. Now clicking submit performs the validation and really does
submit.
Hopefully a more elegant solution will be found in the validation
plugin itself, but as a jquery newbie, I found reading the validation
plugin code daunting!