Re: [jQuery] (validation): remote rule causes submit to abort, fix included

2009-12-30 Thread amschroeder

I ran into the same problem as Ken.

Calling $(#form).validate().form() would yield true, even when the remote
validation should have been failing.  The problem is... 

(1) When calling .validate.form() -- it returns prematurely with the status
of pending for all remote validation rules.

(2) After the call to .validate.form() -- the validating ajax call returns
with the proper status; however, at this point, it's too late.  Even calling
.validate.form() twice will not work, as the code checks each value against
the previous value.

Ken's solution fixed my problem, but I would love to see it included in the
jquery validation package.  I love this plugin and I appreciate all of the
hard work that went into it.

Many thanks,
Adam



KenGreer wrote:
 
 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!
 
 

-- 
View this message in context: 
http://old.nabble.com/%28validation%29%3A-remote-rule-causes-submit-to-abort%2C-fix--included-tp26874437s27240p26963755.html
Sent from the jQuery General Discussion mailing list archive at Nabble.com.



[jQuery] (validation): remote rule causes submit to abort, fix included

2009-12-21 Thread KenGreer
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!


Re: [jQuery] (validation): remote rule causes submit to abort, fix included

2009-12-21 Thread Jörn Zaefferer
The plugin will submit the form after the async request finishes. The
remaining problem is that any submit-button won't be submitted. Maybe thats
the problem you had?

Jörn

On Mon, Dec 21, 2009 at 8:15 AM, KenGreer k...@dancesoft.com wrote:

 With the validation plugin (http://bassistance.de/jquery-plugins/
 jquery-plugin-validation/http://bassistance.de/jquery-plugins/%0Ajquery-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!



Re: [jQuery] (validation): remote rule causes submit to abort, fix included

2009-12-21 Thread Andre Polykanine
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; WlmMSN: arthaelon @ yandex.ru; Jabber: arthaelon @ 
jabber.org
Yahoo! messenger: andre.polykanine; ICQ: 191749952
Twitter: m_elensule

- Original message -
From: KenGreer k...@dancesoft.com
To: jQuery (English) jquery-en@googlegroups.com
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!