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, Geoffrey <geoffreydhug...@gmail.com> wrote:
>
> I've been building up my validation using the jquery validation plugin
> but I can't work out how to get a failed validation to default the
> focus to the first invalid input rather than to the last selected
> input.
>
> If there is no input field selected, when I submit then a failed
> validation will focus the cursor on the first field but if the cursor
> was left in a field and submitted then the focus stays there (if it's
> invalid) rather than jump to the first invalid input.  From what I've
> read and seen, this is the expected behaviour but not what I want.
>
> Is there a way I can get the first invalid field and set the focus to
> that?
>
> A demo of what I have built up so far can be seen at
> https://webdev2.otago.ac.nz/oihrn2009/
>
> All my jquery validation can be found in
> https://webdev2.otago.ac.nz/oihrn2009/javascript/document.ready.all.js
>
>

Reply via email to