Thanks again ... I'll try that approach 2009/10/5 cordenier christophe <christophe.corden...@gmail.com>
> Hi > As you have clearlay said id, the problem is to generate javascript > initialization code once everything is rendered. I think that the > AfterRender of the main page is not called in an Zone refresh. Only the > block is rendered. > > Replacing the block by a 'component' will allow you to implement such a > method. > > Christophe. > > > 2009/10/5 Toby Hobson <toby.hob...@googlemail.com> > > > Sorry to clarify ... > > > > "I guess the problem is that the textField is nested in a block which is > > rendered using AJAX so although the page has completed it's rendering the > > textField has not yet being rendered therefore it doesn't have a > clientId?" > > > > 2009/10/5 Toby Hobson <toby.hob...@googlemail.com> > > > > > Hi Christophe > > > > > > Unfortunately this doesn't seem to work, although maybe I have missed > > > something. For example > > > > > > @Component > > > private TextField techFirstName; > > > > > > void afterRender() { > > > logger.debug("techFirstName clientId: " + > techFirstName.getClientId()); > > > } > > > > > > [DEBUG] pages.Order techFirstName clientId: null > > > > > > I guess the problem is that the textField is nested in a block which is > > > rendered using javascript so although the page has completed it's > > rendering > > > the textField has not yet being rendered therefore it doesn't have a > > > clientId? > > > > > > Toby > > > > > > 2009/10/5 cordenier christophe <christophe.corden...@gmail.com> > > > > > > Hello > > >> > > >> You'd better use a RenderSupport and @AfterRender to create a > javascript > > >> method call that will link your checkbox with the copyDetails() > method. > > >> > > >> Something like this, i guess : > > >> > > >> In a separate JS file injected via @IncludeJavascript > > >> > > >> copyDetails : function(techFirstId) { > > >> .... > > >> } > > >> > > >> linkDetails: function(checkBoxId){ > > >> $(checkBoxId).observer('click', ...); > > >> } > > >> > > >> And your page > > >> > > >> @Inject > > >> private RenderSupport renderSupport; > > >> > > >> @InjectComponent > > >> private TextField techFirstName; > > >> > > >> @AfterRender > > >> private void linkDetails(){ > > >> renderSupport.addScript('linkDetails(%s);' > > techFirstName.getClientId()); > > >> } > > >> > > >> Regards. > > >> > > > > > > > > >