You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by haipeng du <ha...@gmail.com> on 2007/03/02 18:23:23 UTC

tapestry 4 to focus on specified field

How could I set up form and field to make tapestry form focus on specified
field. In the form, it is only one parameter called "focus" which is
boolean. It should have parameter that takes a list of fields name or id for
focus order. Does t4 have that?
Thanks a lot.


-- 
Haipeng Du
Software Engineer
Comphealth,
Salt Lake City

Re: tapestry 4 to focus on specified field

Posted by Jesse Kuhnert <jk...@gmail.com>.
You can also just call "tapestry.form.focusField('yourFieldId')"
directly via javascript at the bottom of your page. (if you felt like
being dirty about it...)

http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/js/tapestry/form.js?view=markup

On 3/3/07, andyhot <an...@di.uoa.gr> wrote:
> haipeng du wrote:
> > I know these. But I just think that may be useful and helpful to add
> > focus
> > fields order list to form.
> Just add a tabindex informal parameter to the related form fields...
> You have to manage focus ordering yourself.
>
>
> >
> > On 3/2/07, Howard Lewis Ship <hl...@gmail.com> wrote:
> >>
> >> Tapestry will add JavaScript to focus on the first field that has an
> >> error. If no fields are in error, then the first required field. If no
> >> required fields, then the first field, period.
> >>
> >> The focus parameter is used when you have multiple forms on one page,
> >> and want to control which one gets to take focus.
> >>
> >> On 3/2/07, haipeng du <ha...@gmail.com> wrote:
> >> > How could I set up form and field to make tapestry form focus on
> >> specified
> >> > field. In the form, it is only one parameter called "focus" which is
> >> > boolean. It should have parameter that takes a list of fields name
> >> or id
> >> for
> >> > focus order. Does t4 have that?
> >> > Thanks a lot.
> >> >
> >> >
> >> > --
> >> > Haipeng Du
> >> > Software Engineer
> >> > Comphealth,
> >> > Salt Lake City
> >> >
> >>
> >>
> >> --
> >> Howard M. Lewis Ship
> >> TWD Consulting, Inc.
> >> Independent J2EE / Open-Source Java Consultant
> >> Creator and PMC Chair, Apache Tapestry
> >> Creator, Apache HiveMind
> >>
> >> Professional Tapestry training, mentoring, support
> >> and project work.  http://howardlewisship.com
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> >> For additional commands, e-mail: users-help@tapestry.apache.org
> >>
> >>
> >
> >
>
>
> --
> Andreas Andreou - andyhot@apache.org - http://andyhot.di.uoa.gr
> Tapestry / Tacos developer
> Open Source / J2EE Consulting
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
Jesse Kuhnert
Tapestry/Dojo team member/developer

Open source based consulting work centered around
dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: tapestry 4 to focus on specified field

Posted by andyhot <an...@di.uoa.gr>.
haipeng du wrote:
> I know these. But I just think that may be useful and helpful to add 
> focus
> fields order list to form.
Just add a tabindex informal parameter to the related form fields...
You have to manage focus ordering yourself.


>
> On 3/2/07, Howard Lewis Ship <hl...@gmail.com> wrote:
>>
>> Tapestry will add JavaScript to focus on the first field that has an
>> error. If no fields are in error, then the first required field. If no
>> required fields, then the first field, period.
>>
>> The focus parameter is used when you have multiple forms on one page,
>> and want to control which one gets to take focus.
>>
>> On 3/2/07, haipeng du <ha...@gmail.com> wrote:
>> > How could I set up form and field to make tapestry form focus on
>> specified
>> > field. In the form, it is only one parameter called "focus" which is
>> > boolean. It should have parameter that takes a list of fields name 
>> or id
>> for
>> > focus order. Does t4 have that?
>> > Thanks a lot.
>> >
>> >
>> > --
>> > Haipeng Du
>> > Software Engineer
>> > Comphealth,
>> > Salt Lake City
>> >
>>
>>
>> -- 
>> Howard M. Lewis Ship
>> TWD Consulting, Inc.
>> Independent J2EE / Open-Source Java Consultant
>> Creator and PMC Chair, Apache Tapestry
>> Creator, Apache HiveMind
>>
>> Professional Tapestry training, mentoring, support
>> and project work.  http://howardlewisship.com
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>
>


-- 
Andreas Andreou - andyhot@apache.org - http://andyhot.di.uoa.gr
Tapestry / Tacos developer
Open Source / J2EE Consulting 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: tapestry 4 to focus on specified field

Posted by Matt Brock <br...@gmail.com>.

flyabovesun wrote:
> 
> I know these. But I just think that may be useful and helpful to add focus
> fields order list to form.

The problem is that it's difficult to know what field you want to first take
focus if you are trying to do it automatically.  For instance, if you have a
page with a header on top with a login form (name / password / submit), but
the "content" area of the page is a search form.  What gets the focus?  The
username field or the first search criteria?

The way I handle this is to simply assign an ID to the field, then at the
bottom of the HTML, just before the close BODY tag, add a javascript call to
specify which form field I want focused --
document.getElementById("formFieldId").focus()

As for the tab order, just add the "tabindex=x" property to the form field
(where 'x' == the numerical order), as already suggested.
-- 
View this message in context: http://www.nabble.com/tapestry-4-to-focus-on-specified-field-tf3334811.html#a9729361
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: tapestry 4 to focus on specified field

Posted by haipeng du <ha...@gmail.com>.
I know these. But I just think that may be useful and helpful to add focus
fields order list to form.

On 3/2/07, Howard Lewis Ship <hl...@gmail.com> wrote:
>
> Tapestry will add JavaScript to focus on the first field that has an
> error. If no fields are in error, then the first required field. If no
> required fields, then the first field, period.
>
> The focus parameter is used when you have multiple forms on one page,
> and want to control which one gets to take focus.
>
> On 3/2/07, haipeng du <ha...@gmail.com> wrote:
> > How could I set up form and field to make tapestry form focus on
> specified
> > field. In the form, it is only one parameter called "focus" which is
> > boolean. It should have parameter that takes a list of fields name or id
> for
> > focus order. Does t4 have that?
> > Thanks a lot.
> >
> >
> > --
> > Haipeng Du
> > Software Engineer
> > Comphealth,
> > Salt Lake City
> >
>
>
> --
> Howard M. Lewis Ship
> TWD Consulting, Inc.
> Independent J2EE / Open-Source Java Consultant
> Creator and PMC Chair, Apache Tapestry
> Creator, Apache HiveMind
>
> Professional Tapestry training, mentoring, support
> and project work.  http://howardlewisship.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
Haipeng Du
Software Engineer
Comphealth,
Salt Lake City

Re: tapestry 4 to focus on specified field

Posted by Howard Lewis Ship <hl...@gmail.com>.
Tapestry will add JavaScript to focus on the first field that has an
error. If no fields are in error, then the first required field. If no
required fields, then the first field, period.

The focus parameter is used when you have multiple forms on one page,
and want to control which one gets to take focus.

On 3/2/07, haipeng du <ha...@gmail.com> wrote:
> How could I set up form and field to make tapestry form focus on specified
> field. In the form, it is only one parameter called "focus" which is
> boolean. It should have parameter that takes a list of fields name or id for
> focus order. Does t4 have that?
> Thanks a lot.
>
>
> --
> Haipeng Du
> Software Engineer
> Comphealth,
> Salt Lake City
>


-- 
Howard M. Lewis Ship
TWD Consulting, Inc.
Independent J2EE / Open-Source Java Consultant
Creator and PMC Chair, Apache Tapestry
Creator, Apache HiveMind

Professional Tapestry training, mentoring, support
and project work.  http://howardlewisship.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org