You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Madhavan Thirumalai <ma...@letsgaggle.com> on 2005/09/17 01:42:05 UTC

Disabling auto focus Tapestry 3

Howard and other have discussed this issue in the archives and it is being
addressed in Tapestry 4. But I need a solution in Tapestry 3. Here is the
quote from the archives.

> The method addSelect(IRequestCycle) (line 131) adds JavaScript code to 
> the body in order to automatically select and focus the ValidField. 
> Though this feature is very nice it would be useful if there was a way 
> to disable it. For example let's assume a rather long page where the 
> form is located at the end of the page. The current implementation 
> causes the browser to jump to the end of the page and therefore hide 
> the beginning of the page.

This is the situation I am facing. I absolutely need my page to scroll to
the top. I tried the hack of inserting Javascript - window.scrollTo() at the
very bottom of the page and the following code was generated. 
window.onload = function ()
{
document.Form10.SearchEarliestTime.focus();
document.Form10.SearchEarliestTime.select();
    window.scrollTo(0,0);
}
This works in Firefox but not to work consistently in IE. It also disgusts
me.

Is there a non hacky way to do this? The cleanest would be if I could
supress the calls to focus() and select() altogether.

Thanks,
Madhavan



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


Re: Disabling auto focus Tapestry 3

Posted by Kent Tong <ke...@cpttm.org.mo>.
Madhavan Thirumalai <mad <at> letsgaggle.com> writes:

> Howard and other have discussed this issue in the archives and it is being
> addressed in Tapestry 4. But I need a solution in Tapestry 3. Here is the
> quote from the archives.

Have you tried calling:
      
cycle.setAttribute("org.apache.tapestry.component.html.valid.SelectedFieldSet", 
  Boolean.TRUE);

in pageBeginRender()?

--
Author of a book for learning Tapestry (www.agileskills2.org/EWDT)


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