Re: [jQuery] The form is not submitted onKeyDown

2010-01-07 Thread Nathan Klatt
On Thu, Jan 7, 2010 at 11:04 AM, Andre Polykanine wrote:
> var validator=$("#myform").validate( {  });
>
> $(document).keydown (function (e) {
>if (e.ctrlKey && e.which==13) { validator.form(); }
> });
>
> then I'm trying to submit. If I do something wrong (for example, leave
> a required field blank) and press Ctrl+Enter, Validator gently tells
> me that yes, that field is required, go on and fill it in. But if I
> fill in the field and do everything correctly, pressing Ctrl+Enter
> gives absolutely nothing: no errors and no submit.

It's not submitting because you never tell it to. I would first try
replacing the call to validator.form() with $("#myform").submit(). I
would assume that does the validation check first. In case doing that
bypasses the validation, check the return value of validator.form()
and submit if it's successful, a la: if (validator.form())
$("#myform").submit();.

Nathan


[jQuery] The form is not submitted onKeyDown

2010-01-07 Thread Andre Polykanine
Hello everyone,

I'm trying to submit the form normally as well as by pressing
Ctrl+Enter. Yepp, the same task.
What I'm doing is the following:

 var validator=$("#myform").validate( {
 // tralala, here go the rules, error
 messages and stuff
 });

$(document).keydown (function (e) {
if (e.ctrlKey && e.which==13) {
validator.form();
}
});

then I'm trying to submit. If I do something wrong (for example, leave
a required field blank) and press Ctrl+Enter, Validator gently tells
me that yes, that field is required, go on and fill it in. But if I
fill in the field and do everything correctly, pressing Ctrl+Enter
gives absolutely nothing: no errors and no submit. the simple click on
the Submit button, however, does give the expected result.
Where am I wrong?
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



[jQuery] The form is not submitted onKeyDown

2009-12-27 Thread Andre Polykanine
Hello everyone,

I'm trying to sumbit the form normally as well as by pressing
Ctrl+Enter. Yepp, the same task.
What I'm doing is the following:

 var validator=$("#myform").validate( {
 // tralala, here go the rules, error
 messages and stuff
 });

$(document).keydown (function (e) {
if (e.ctrlKey && e.which==13) {
validator.form();
}
});

then I'm trying to submit. If I do something wrong (for example, leave
a required field blank) and press Ctrl+Enter, Validator gently tells
me that yes, that field is required, go on and fill it in. But if I
fill in the field and do everything correctly, pressing Ctrl+Enter
gives absolutely nothing: no errors and no submit. the simple click on
the Submit button, however, does give the expected result.
Where am I wrong?
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