[jQuery] Re: Validate: Focus on first invalid field after validation

2009-09-15 Thread Geoffrey
Ok, the problem with the non-validated fields submitting on hitting return twice is resolved by removing the following... onfocusout: function(element) { $(element).valid(); }, The problem is, I want this as I want an error to show if they tab through required fields and leave them blank

[jQuery] Re: Validate: Focus on first invalid field after validation

2009-09-15 Thread Geoffrey
Not for me. In Safari 4 and Firefox 3.5.3 under Snow Leopard and Firefox 3.5.3 under XP: Click in a required field (not the first one) and hit return. Focus stays in the focused field. Hit return again and the focus jumps to the first invalid field. If you focus a non-required field and hit r

[jQuery] Re: Validate: Focus on first invalid field after validation

2009-09-15 Thread Jörn Zaefferer
I can't reproduce that. Seems to work fine for me. Jörn On Tue, Sep 15, 2009 at 11:40 PM, Geoffrey wrote: > > Hmmm...I tried this but I discovered on the first submit that it > doesn't focus the first invalid field but it will if I hit return to > submit again. > > Also, when hitting submit on

[jQuery] Re: Validate: Focus on first invalid field after validation

2009-09-15 Thread Geoffrey
Hmmm...I tried this but I discovered on the first submit that it doesn't focus the first invalid field but it will if I hit return to submit again. Also, when hitting submit on a field that's not checked for validity, the form will submit successfully this second time as well despite still having

[jQuery] Re: Validate: Focus on first invalid field after validation

2009-09-15 Thread Geoffrey
Damn. I always forget about :first. Thanks. On Sep 16, 8:34 am, Jörn Zaefferer wrote: > Something like this? > > $("form").validate({ >   focusInvalid: false, >   invalidHandler: function() { >     $(this).find(":input.error:first").focus(); >   } > > }); > > Jörn > > > > On Tue, Sep 15, 200

[jQuery] Re: Validate: Focus on first invalid field after validation

2009-09-15 Thread Jörn Zaefferer
Something like this? $("form").validate({ focusInvalid: false, invalidHandler: function() { $(this).find(":input.error:first").focus(); } }); Jörn On Tue, Sep 15, 2009 at 10:24 PM, Geoffrey wrote: > > I guess I'm going to have too.  I just need to work out how to return > the first i

[jQuery] Re: Validate: Focus on first invalid field after validation

2009-09-15 Thread Geoffrey
I guess I'm going to have too. I just need to work out how to return the first invalid field so I can set the focus. On Sep 16, 8:16 am, Jörn Zaefferer wrote: > Well, you can set focusInvalid: false and implement invalidHandler to > focus the first field. That should do the trick. > > Jörn >

[jQuery] Re: Validate: Focus on first invalid field after validation

2009-09-15 Thread Jörn Zaefferer
Well, you can set focusInvalid: false and implement invalidHandler to focus the first field. That should do the trick. Jörn On Tue, Sep 15, 2009 at 10:01 PM, Geoffrey wrote: > > And what if you enter an invalid character in an input at the bottom > of the field? For example entering a letter in

[jQuery] Re: Validate: Focus on first invalid field after validation

2009-09-15 Thread Geoffrey
And what if you enter an invalid character in an input at the bottom of the field? For example entering a letter in the Conference Dinner input of my sample form. A user is going to miss the error message at the top of the form along with other input errors if there's an error in the last inputs

[jQuery] Re: Validate: Focus on first invalid field after validation

2009-09-15 Thread Jörn Zaefferer
Whats wrong with keeping the focus on the active field, if its invalid? If you enter something into the, say, third field, hit enter to submit, then it turns out both that field and another before that are invalid, why move the focus to a different field? Jörn On Tue, Sep 8, 2009 at 4:47 AM, Ge