I don't know jQuery but does this only work if the first form element
is an 'input'?  What about if the first form element is a 'select' or
a 'textarea'?

On Nov 1, 4:18 pm, mdipierro <[EMAIL PROTECTED]> wrote:
> Exellent point but there is a much easier solution.
>
> <script>
> $(document).ready(function() { $
> ("input:visible:enabled:first").focus(); });
> </script>
>
> This will always focus the first visible field of the first form.
> I now added it in web2py_ajax.html and will be the default with the
> next web2py version.
>
> Never underestimate the power of jQuery!
>
> Massimo
>
> On Oct 31, 4:57 pm, "Wes James" <[EMAIL PROTECTED]> wrote:
>
> > I like it when an input box is already selected on a page with a form
> > when first loaded so I did this with the admin password form.
>
> > in
>
> > admin/views/layout.html
>
> > I changed
>
> > <body>
>
> > to
>
> > <body onload="isApasswd=document.getElementById('apasswd');
> > if(isApasswd) isApasswd.focus();">
>
> > then in
>
> > admin/views/default/index.html
>
> > I changed
>
> > <input type="password" name="password"/>
>
> > to
>
> > <input id="apasswd" type="password" name="password"/>
>
> > I'm not sure how else you would do this since the layout.html seems to
> > be an outer layer to a lot of other web2by chunks...
>
> > c/ya,
>
> > newb web2py user,
>
> > -wj
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to