You can achieve this the T5 way by doing this in the page that contains the textbox, no need to mess with layout etc. this can even be in a component...:
@Environmental private RenderSupport renderSupport; void setupRender() { renderSupport.addScript("document.getElementById('%s').focus();", "text1"); } Of course, you can do this in afterRender also. It is all explained in http://tapestry.apache.org/tapestry5/guide/ajax.html Also, you can inject the textbox using @Component annotation to avoid typing that id in plain text. @Component private TextField text1; . . . renderSupport.addScript("document.getElementById('%s').focus();", text1.getClientId()); - Ville wesleywj2 wrote: > > hi, > > i'm trying to do an automatic focus on 1 of 3 textfield input upon the > page render. > > so i thought in my textfield > > <input type="text" t:type="TextField" t:value="text1" > onchange="this.form.submit()"/> > > upon resubmit this page, the onLoad attribute in <body> can call the > javascript > document.getElementById('text1').focus(); > > but the environment of my page is using Layout component, the textfield in > the page does not have a body and i have to include it under my layout.tml > which fails as the browser could not locate the id since its all shared by > different pages. > > anyway i can set the focus upon rerender of pages under my pojo class? in > the documentation, there's no such method. any alternatives is welcome. > > please advise. > > thanks & regards, > wesley > -- View this message in context: http://www.nabble.com/T5-How-to-onLoad-focus%28%29-to-textfield-in-Layout-component-tp23055988p23057325.html Sent from the Tapestry - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org