WebAIM - Web Accessibility In Mind

E-mail List Archives

Thread: Setting focus in a php form

for

Number of posts in this thread: 5 (In chronological order)

From: Erika Noll Webb
Date: Wed, Sep 13 2006 10:50AM
Subject: Setting focus in a php form
No previous message | Next message →

We're working on a project where we have a php form that displays new fields
after it makes a call to the database to determine what options will be
available based on user decisions previously in the form. I'm trying to
figure out a good way to reset the focus to the next section of the form
after each action. Does anybody know a good way to do this? Right now, the
page scrolls, but it's not really resetting the focus (although visually it
might seem like it does). It's a hack, and I'd like a cleaner and more
accessible solution.

Thanks,
Erika

Erika Noll Webb, Ph.D.
Partner, Quintus Design

NEW ADDRESS!
5370 Manhattan Circle Suite 105
Boulder CO 80303
o) 303.449.5020
m) 720.319.2145
f) 303.449.7045
IM erikanollwebb





From: Jon Gunderson
Date: Wed, Sep 13 2006 11:50AM
Subject: Re: Setting focus in a php form
← Previous message | Next message →

You try using TABINDEX attribute, this would make the first tab go a the element you want to have focus.

This would probably only work if the page was be totally reloaded not if you were dynamically updating the content.

Jon


---- Original message ----
>Date: Wed, 13 Sep 2006 10:41:39 -0600
>From: "Erika Noll Webb" < = EMAIL ADDRESS REMOVED = >
>Subject: [WebAIM] Setting focus in a php form
>To: "'WebAIM Discussion List'" < = EMAIL ADDRESS REMOVED = >, < = EMAIL ADDRESS REMOVED = >
>
>We're working on a project where we have a php form that displays new fields
>after it makes a call to the database to determine what options will be
>available based on user decisions previously in the form. I'm trying to
>figure out a good way to reset the focus to the next section of the form
>after each action. Does anybody know a good way to do this? Right now, the
>page scrolls, but it's not really resetting the focus (although visually it
>might seem like it does). It's a hack, and I'd like a cleaner and more
>accessible solution.
>
>Thanks,
>Erika
>
>Erika Noll Webb, Ph.D.
>Partner, Quintus Design
>
>NEW ADDRESS!
>5370 Manhattan Circle Suite 105
>Boulder CO 80303
>o) 303.449.5020
>m) 720.319.2145
>f) 303.449.7045
>IM erikanollwebb
>
>
>
>


Jon Gunderson, Ph.D.
Director of IT Accessibility Services
Campus Information Technologies and Educational Services (CITES)
and
Coordinator of Assistive Communication and Information Technology
Disability Resources and Education Services (DRES)

Voice: (217) 244-5870
Fax: (217) 333-0248
Cell: (217) 714-6313

E-mail: = EMAIL ADDRESS REMOVED =

WWW: http://cita.rehab.uiuc.edu/
WWW: https://netfiles.uiuc.edu/jongund/www/






From: Jon May
Date: Wed, Sep 13 2006 3:50PM
Subject: Re: Setting focus in a php form
← Previous message | Next message →

Hi Erika,

Is there any you can send the number of the tabindex your form is up to
to the script that generates the new section of the form? This way you
assign the next tabinex+1 and set focus there.

Using an AJAX style setup might be a solution too, but that would not be
very accessible.

If you would like me to have a look at the script let me know via my
email in my signature.

Regards,
Jon May
Mayhem Design
E: = EMAIL ADDRESS REMOVED =



Erika Noll Webb wrote:

>We're working on a project where we have a php form that displays new fields
>after it makes a call to the database to determine what options will be
>available based on user decisions previously in the form. I'm trying to
>figure out a good way to reset the focus to the next section of the form
>after each action. Does anybody know a good way to do this? Right now, the
>page scrolls, but it's not really resetting the focus (although visually it
>might seem like it does). It's a hack, and I'd like a cleaner and more
>accessible solution.
>
>Thanks,
>Erika
>
>Erika Noll Webb, Ph.D.
>Partner, Quintus Design
>
>NEW ADDRESS!
>5370 Manhattan Circle Suite 105
>Boulder CO 80303
>o) 303.449.5020
>m) 720.319.2145
>f) 303.449.7045
>IM erikanollwebb
>
>
>
>
>
>
>




From: ben morrison
Date: Thu, Sep 14 2006 3:00AM
Subject: Re: Setting focus in a php form
← Previous message | Next message →

On 9/13/06, Erika Noll Webb < = EMAIL ADDRESS REMOVED = > wrote:
> We're working on a project where we have a php form that displays new fields
> after it makes a call to the database to determine what options will be
> available based on user decisions previously in the form. I'm trying to
> figure out a good way to reset the focus to the next section of the form
> after each action. Does anybody know a good way to do this? Right now, the
> page scrolls, but it's not really resetting the focus (although visually it
> might seem like it does). It's a hack, and I'd like a cleaner and more
> accessible solution.

How does this work currently, does the page refresh or are you using
javascript to achieve this?

An example page would be helpful

ben




From: Moore, Michael
Date: Thu, Sep 14 2006 8:10AM
Subject: RE: Setting focus in a php form
← Previous message | No next message

Since you are using PHP, I will assume that you are adding the fields on
the server side. I would also write a new anchor and send the form back
to the url with the in-page anchor. This isn't perfect in IE and may
require a small hack but it will set the focus in the proper location.

Mike