[pmwiki-users] Input boxes on forms
Patrick R. Michaud
pmichaud at pobox.com
Sat Jun 2 10:22:36 CDT 2007
On Sat, Jun 02, 2007 at 08:41:32AM -0500, Patrick R. Michaud wrote:
> On Sat, Jun 02, 2007 at 03:46:36AM -0700, Ian MacGregor wrote:
> > I am using PmForm to implement a contact form on my site:
> > http://imacgregor.com/pmwiki.php?n=Contact.ContactForm
> > When I open this page in Firefox I notice that none of the text
> > boxes are focused. I'd like that first box to be focused (cursor)
> > when a > > visitor opens that page. Is it possible to automatically
> > set focus to an (:input ... :) element when a user opens a page?
> At present, no, this is one of the things I'm hoping to have in
> 2.2.0, however.
Okay, it's present now, in 2.2.0-beta53 (just released).
Simply add "focus=1" to the (:input ... :) element you want to
receive the focus when the page is loaded, as in:
(:input text xyz focus=1:)
It's possible for multiple input elements to specify a focus=
option; in this case, the first element with the smallest value
"wins". So, specifying (:input ... focus=10 :) effectively says
"give this element the focus unless there's some other element
on the page with a 'focus=' value smaller than 10".
To many it may seem that we should use larger values of focus=
to indicate "higher priority", but I decided that it's better
to stay somewhat consistent with the existing meaning of
tabindex=, where lower values mean "go to this element first".
I'll also be looking at ways to improve tabindex= specification,
(e.g., taking some ideas from http://pmwiki.org/wiki/PITS/00794).
Comments and questions welcomed.
More information about the pmwiki-users