You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by N Raju <it...@yahoo.com> on 2009/02/06 15:03:21 UTC

How to set the focus to a specific filed on form using tapestry 4.1.5

Hi

I am new to Tapestry. I am using tapestry 4.1.5 in my application. By
default the form is getting the focus on combo box which is the first form
element in the webpage. But , any user may accidentally change the selected
data in the combo by scrolling the mouse using middle key. Hence I would
like to have the foucus on submit button. But I am not sure how to modify
tapestry code so that the defalut focus to the first field could be changed
to any other field of the form.

any help is much appreciated.

kind regards

Naga
-- 
View this message in context: http://www.nabble.com/How-to-set-the-focus-to-a-specific-filed-on-form-using-tapestry-4.1.5-tp21872983p21872983.html
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: How to set the focus to a specific filed on form using tapestry 4.1.5

Posted by N Raju <it...@yahoo.com>.
Hi Many thanks for your reply. First option worked for me.

I tried to implement the second option with a script. But suprisingly, it's
executing the script code first which sets the focus to a textfield and then
again the defaut code which is getting added to the end of rendered html
code and it's setting focus to combobox again. Any suggestion please to
avoid the default code from being not run.

The default code at the end rendered by tapestry is:

<script type="text/javascript"><!--
tapestry.addOnLoad(function(e) {
dojo.require("tapestry.form");tapestry.form.registerForm("filter");
setFocus();

tapestry.form.registerForm("stores");

tapestry.form.focusField('FromWaveNumber');});
// --></script></body>

  </html>
<!-- Render time: ~ 156 ms -->

regards

Raju


Andreas Andreou-4 wrote:
> 
> 2 options.
> 1) http://tapestry.apache.org/tapestry4.1/components/form/form.html -
> perhaps setting
> focus="false" in that form is enough for your usecase.
> 2) define your own js code for tapestry.form.focusField that perhaps
> ignores comboboxes.
> 
> On Fri, Feb 6, 2009 at 4:03 PM, N Raju <it...@yahoo.com> wrote:
>>
>> Hi
>>
>> I am new to Tapestry. I am using tapestry 4.1.5 in my application. By
>> default the form is getting the focus on combo box which is the first
>> form
>> element in the webpage. But , any user may accidentally change the
>> selected
>> data in the combo by scrolling the mouse using middle key. Hence I would
>> like to have the foucus on submit button. But I am not sure how to modify
>> tapestry code so that the defalut focus to the first field could be
>> changed
>> to any other field of the form.
>>
>> any help is much appreciated.
>>
>> kind regards
>>
>> Naga
>> --
>> View this message in context:
>> http://www.nabble.com/How-to-set-the-focus-to-a-specific-filed-on-form-using-tapestry-4.1.5-tp21872983p21872983.html
>> 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
>>
>>
> 
> 
> 
> --
> Andreas Andreou - andyhot@apache.org - http://blog.andyhot.gr
> Tapestry / Tacos developer
> Open Source / JEE Consulting
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/How-to-set-the-focus-to-a-specific-filed-on-form-using-tapestry-4.1.5-tp21872983p21896894.html
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: How to set the focus to a specific filed on form using tapestry 4.1.5

Posted by Andreas Andreou <an...@di.uoa.gr>.
2 options.
1) http://tapestry.apache.org/tapestry4.1/components/form/form.html -
perhaps setting
focus="false" in that form is enough for your usecase.
2) define your own js code for tapestry.form.focusField that perhaps
ignores comboboxes.

On Fri, Feb 6, 2009 at 4:03 PM, N Raju <it...@yahoo.com> wrote:
>
> Hi
>
> I am new to Tapestry. I am using tapestry 4.1.5 in my application. By
> default the form is getting the focus on combo box which is the first form
> element in the webpage. But , any user may accidentally change the selected
> data in the combo by scrolling the mouse using middle key. Hence I would
> like to have the foucus on submit button. But I am not sure how to modify
> tapestry code so that the defalut focus to the first field could be changed
> to any other field of the form.
>
> any help is much appreciated.
>
> kind regards
>
> Naga
> --
> View this message in context: http://www.nabble.com/How-to-set-the-focus-to-a-specific-filed-on-form-using-tapestry-4.1.5-tp21872983p21872983.html
> 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
>
>



--
Andreas Andreou - andyhot@apache.org - http://blog.andyhot.gr
Tapestry / Tacos developer
Open Source / JEE Consulting

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