Re: RadioChoice and Ajax to display a panel of dropdowns
The books you mentioned are the places to look at. If i google "wicket component not visible" the third entry brings up the solution. And in the list this question was answered quite often. But it surely depends on search phrase. But now it's answered again. At least here you will get almost ever an answer. Cheers Per Adding the call to that method seemed to solve the problem. The places you mentioned are the usual places to look for information. However I searched the list, read the wiki, checked the examples, and looked through some books. I also tried to google what I was trying to do. It just seemed like this was a pretty common thing to do and I would have thought an answer would have been found much quicker. Do you recommend any books in particular. I have "Wicket in Action" and have ordered "Pro Wicket". Are there other books that I should be looking at? Thanks. Jeff - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
RE: RadioChoice and Ajax to display a panel of dropdowns
Adding the call to that method seemed to solve the problem. The places you mentioned are the usual places to look for information. However I searched the list, read the wiki, checked the examples, and looked through some books. I also tried to google what I was trying to do. It just seemed like this was a pretty common thing to do and I would have thought an answer would have been found much quicker. Do you recommend any books in particular. I have "Wicket in Action" and have ordered "Pro Wicket". Are there other books that I should be looking at? Thanks. Jeff -Original Message- From: Per Newgro [mailto:per.new...@gmx.ch] Sent: Wednesday, September 30, 2009 2:09 PM To: users@wicket.apache.org Subject: Re: RadioChoice and Ajax to display a panel of dropdowns Only a shot in the dark, but is typeBox.setOutputMarkupPlaceholderTag(true) helping? You could use it instead of setOutputMarkupId(true), because its done there to. Otherwise i would have to create a testcase for this situation. There are different places to get informations: - search this list - read the wiki - check the examples - read a wicket book (many good out there) It's all explained on the website. Or do you expect them elsewhere? Cheers Per > I did not override the method.I just did and it is still not > working. Here is what I have: > > Also, where would one find this type of information. I don't think the > online example show it and blindly guessing methods to look at in > javadoc doesn't seem efficient. > > HTML: > > Type of > User: > > > option 1 > > > > > > The type > box > > > Code: > // Account Type sub box > final WebMarkupContainer typeBox = new > WebMarkupContainer("typeBox") { > > /* (non-Javadoc) >* @see > org.apache.wicket.Component#callOnBeforeRenderIfNotVisible() >*/ > @Override > protected boolean > callOnBeforeRenderIfNotVisible() { > return true; > } > > }; > typeBox.setVisible(false); > typeBox.setOutputMarkupId(true); > add(typeBox); > > // Account Type Select > List accountTypes = accountTypeDao.findAll(); > ChoiceRenderer accountTypeChoiceRenderer = new > ChoiceRenderer("name", "code"); > RadioChoice accountTypeRadio = new > RadioChoice("accountType", accountTypes, accountTypeChoiceRenderer); > //accountTypeRadio.setRequired(true); > // add the on click to the radio button > accountTypeRadio.add(new > AjaxFormChoiceComponentUpdatingBehavior () { > private static final long serialVersionUID = 1L; > > @Override > protected void onUpdate(AjaxRequestTarget target) { > RadioChoice choice = (RadioChoice) > getComponent(); > choice.updateModel(); > > if (((AccountType) > choice.getModelObject()).getCode().equalsIgnoreCase("REP")) { > typeBox.setVisible(true); > } else { > typeBox.setVisible(false); > } > target.addComponent(typeBox); > } > }); > > add(accountTypeRadio); > > > -Original Message- > From: Per Newgro [mailto:per.new...@gmx.ch] > Sent: Wednesday, September 30, 2009 2:17 AM > To: users@wicket.apache.org > Subject: Re: RadioChoice and Ajax to display a panel of dropdowns > > Hey Jeff, > > did you override this? > > > /** > * Override this method if you want onBeforeRender to be called even > > when your component is not > * visible. default this returns false. > * > * @return boolean, if true then onBeforeRender is called even for > none visible components, > * default false. > * > * @see
Re: RadioChoice and Ajax to display a panel of dropdowns
Only a shot in the dark, but is typeBox.setOutputMarkupPlaceholderTag(true) helping? You could use it instead of setOutputMarkupId(true), because its done there to. Otherwise i would have to create a testcase for this situation. There are different places to get informations: - search this list - read the wiki - check the examples - read a wicket book (many good out there) It's all explained on the website. Or do you expect them elsewhere? Cheers Per I did not override the method.I just did and it is still not working. Here is what I have: Also, where would one find this type of information. I don't think the online example show it and blindly guessing methods to look at in javadoc doesn't seem efficient. HTML: Type of User: option 1 The type box Code: // Account Type sub box final WebMarkupContainer typeBox = new WebMarkupContainer("typeBox") { /* (non-Javadoc) * @see org.apache.wicket.Component#callOnBeforeRenderIfNotVisible() */ @Override protected boolean callOnBeforeRenderIfNotVisible() { return true; } }; typeBox.setVisible(false); typeBox.setOutputMarkupId(true); add(typeBox); // Account Type Select List accountTypes = accountTypeDao.findAll(); ChoiceRenderer accountTypeChoiceRenderer = new ChoiceRenderer("name", "code"); RadioChoice accountTypeRadio = new RadioChoice("accountType", accountTypes, accountTypeChoiceRenderer); //accountTypeRadio.setRequired(true); // add the on click to the radio button accountTypeRadio.add(new AjaxFormChoiceComponentUpdatingBehavior () { private static final long serialVersionUID = 1L; @Override protected void onUpdate(AjaxRequestTarget target) { RadioChoice choice = (RadioChoice) getComponent(); choice.updateModel(); if (((AccountType) choice.getModelObject()).getCode().equalsIgnoreCase("REP")) { typeBox.setVisible(true); } else { typeBox.setVisible(false); } target.addComponent(typeBox); } }); add(accountTypeRadio); -Original Message- From: Per Newgro [mailto:per.new...@gmx.ch] Sent: Wednesday, September 30, 2009 2:17 AM To: users@wicket.apache.org Subject: Re: RadioChoice and Ajax to display a panel of dropdowns Hey Jeff, did you override this? /** * Override this method if you want onBeforeRender to be called even when your component is not * visible. default this returns false. * * @return boolean, if true then onBeforeRender is called even for none visible components, * default false. * * @see Component#onBeforeRender() */ protected boolean callOnBeforeRenderIfNotVisible() { return false; } If you add a visible and an invisible panel you have to override this on the invisible one. hth Cheers Per I want to create a list of radio buttons [I have that working] and an ajax event to fire whenever a radio button is clicked [I have this working]. If the radio button matches the one I am interested in then I want to display additional information that must be filled in. A radio button selection is required. I cannot get the additional information to display when I add the component back to the target. I think it is because the additional information is originally set to not visible so the output markup id is not written out. How would I go about doing this? It seems pretty standard. Do I need to use panels and swap the appropriate panel [1 - empty panel, 2 - panel with additional info] into the target when needed? That seems like a lot of code to do something fairly simple. My code is below. Thanks. Jeff = HTML: Type of User:
RE: RadioChoice and Ajax to display a panel of dropdowns
I did not override the method.I just did and it is still not working. Here is what I have: Also, where would one find this type of information. I don't think the online example show it and blindly guessing methods to look at in javadoc doesn't seem efficient. HTML: Type of User: option 1 The type box Code: // Account Type sub box final WebMarkupContainer typeBox = new WebMarkupContainer("typeBox") { /* (non-Javadoc) * @see org.apache.wicket.Component#callOnBeforeRenderIfNotVisible() */ @Override protected boolean callOnBeforeRenderIfNotVisible() { return true; } }; typeBox.setVisible(false); typeBox.setOutputMarkupId(true); add(typeBox); // Account Type Select List accountTypes = accountTypeDao.findAll(); ChoiceRenderer accountTypeChoiceRenderer = new ChoiceRenderer("name", "code"); RadioChoice accountTypeRadio = new RadioChoice("accountType", accountTypes, accountTypeChoiceRenderer); //accountTypeRadio.setRequired(true); // add the on click to the radio button accountTypeRadio.add(new AjaxFormChoiceComponentUpdatingBehavior () { private static final long serialVersionUID = 1L; @Override protected void onUpdate(AjaxRequestTarget target) { RadioChoice choice = (RadioChoice) getComponent(); choice.updateModel(); if (((AccountType) choice.getModelObject()).getCode().equalsIgnoreCase("REP")) { typeBox.setVisible(true); } else { typeBox.setVisible(false); } target.addComponent(typeBox); } }); add(accountTypeRadio); -Original Message- From: Per Newgro [mailto:per.new...@gmx.ch] Sent: Wednesday, September 30, 2009 2:17 AM To: users@wicket.apache.org Subject: Re: RadioChoice and Ajax to display a panel of dropdowns Hey Jeff, did you override this? /** * Override this method if you want onBeforeRender to be called even when your component is not * visible. default this returns false. * * @return boolean, if true then onBeforeRender is called even for none visible components, * default false. * * @see Component#onBeforeRender() */ protected boolean callOnBeforeRenderIfNotVisible() { return false; } If you add a visible and an invisible panel you have to override this on the invisible one. hth Cheers Per > I want to create a list of radio buttons [I have that working] and an > ajax event to fire whenever a radio button is clicked [I have this > working]. If the radio button matches the one I am interested in then I > want to display additional information that must be filled in. A radio > button selection is required. > > > > I cannot get the additional information to display when I add the > component back to the target. I think it is because the additional > information is originally set to not visible so the output markup id is > not written out. How would I go about doing this? It seems pretty > standard. Do I need to use panels and swap the appropriate panel [1 - > empty panel, 2 - panel with additional info] into the target when > needed? That seems like a lot of code to do something fairly simple. > > > > My code is below. > > > > Thanks. > > > > Jeff > > > > = > > > > HTML: > > > > Type of > User: > > > > > > option 1 > > > > > > > > > > > >
Re: RadioChoice and Ajax to display a panel of dropdowns
Hey Jeff, did you override this? /** * Override this method if you want onBeforeRender to be called even when your component is not * visible. default this returns false. * * @return boolean, if true then onBeforeRender is called even for none visible components, * default false. * * @see Component#onBeforeRender() */ protected boolean callOnBeforeRenderIfNotVisible() { return false; } If you add a visible and an invisible panel you have to override this on the invisible one. hth Cheers Per I want to create a list of radio buttons [I have that working] and an ajax event to fire whenever a radio button is clicked [I have this working]. If the radio button matches the one I am interested in then I want to display additional information that must be filled in. A radio button selection is required. I cannot get the additional information to display when I add the component back to the target. I think it is because the additional information is originally set to not visible so the output markup id is not written out. How would I go about doing this? It seems pretty standard. Do I need to use panels and swap the appropriate panel [1 - empty panel, 2 - panel with additional info] into the target when needed? That seems like a lot of code to do something fairly simple. My code is below. Thanks. Jeff = HTML: Type of User: option 1 The additional information Java Code: // Account Type sub box final WebMarkupContainer typeBox = new WebMarkupContainer("typeBox"); typeBox.setVisible(false); typeBox.setOutputMarkupId(true); add(typeBox); // Account Type Select List accountTypes = accountTypeDao.findAll(); ChoiceRenderer accountTypeChoiceRenderer = new ChoiceRenderer("name", "code"); RadioChoice accountTypeRadio = new RadioChoice("accountType", accountTypes, accountTypeChoiceRenderer); //accountTypeRadio.setRequired(true);// THIS SHOULD REALLY BE REQUIRED // add the on click to the radio button accountTypeRadio.add(new AjaxFormChoiceComponentUpdatingBehavior () { private static final long serialVersionUID = 1L; @Override protected void onUpdate(AjaxRequestTarget target) { RadioChoice choice = (RadioChoice) getComponent(); choice.updateModel(); if (((AccountType) choice.getModelObject()).getCode().equalsIgnoreCase("REP")) { typeBox.setVisible(true); } else { typeBox.setVisible(false); } target.addComponent(typeBox); } }); ___ Jeffrey A. Schneller Envisa End-to-End E-Commerce for the Multi-Channel Merchant 281 Pleasant Street Framingham, MA 01701 P: (508) 405-1220 x115 C: (508) 954-8044 F: (508) 405-1219 - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
RadioChoice and Ajax to display a panel of dropdowns
I want to create a list of radio buttons [I have that working] and an ajax event to fire whenever a radio button is clicked [I have this working]. If the radio button matches the one I am interested in then I want to display additional information that must be filled in. A radio button selection is required. I cannot get the additional information to display when I add the component back to the target. I think it is because the additional information is originally set to not visible so the output markup id is not written out. How would I go about doing this? It seems pretty standard. Do I need to use panels and swap the appropriate panel [1 - empty panel, 2 - panel with additional info] into the target when needed? That seems like a lot of code to do something fairly simple. My code is below. Thanks. Jeff = HTML: Type of User: option 1 The additional information Java Code: // Account Type sub box final WebMarkupContainer typeBox = new WebMarkupContainer("typeBox"); typeBox.setVisible(false); typeBox.setOutputMarkupId(true); add(typeBox); // Account Type Select List accountTypes = accountTypeDao.findAll(); ChoiceRenderer accountTypeChoiceRenderer = new ChoiceRenderer("name", "code"); RadioChoice accountTypeRadio = new RadioChoice("accountType", accountTypes, accountTypeChoiceRenderer); //accountTypeRadio.setRequired(true);// THIS SHOULD REALLY BE REQUIRED // add the on click to the radio button accountTypeRadio.add(new AjaxFormChoiceComponentUpdatingBehavior () { private static final long serialVersionUID = 1L; @Override protected void onUpdate(AjaxRequestTarget target) { RadioChoice choice = (RadioChoice) getComponent(); choice.updateModel(); if (((AccountType) choice.getModelObject()).getCode().equalsIgnoreCase("REP")) { typeBox.setVisible(true); } else { typeBox.setVisible(false); } target.addComponent(typeBox); } }); ___ Jeffrey A. Schneller Envisa End-to-End E-Commerce for the Multi-Channel Merchant 281 Pleasant Street Framingham, MA 01701 P: (508) 405-1220 x115 C: (508) 954-8044 F: (508) 405-1219