On Thu, May 31, 2012 at 11:48 AM, Chris Colman <chr...@stepaheadsoftware.com> wrote: > Doh! That approach fails when I target.add a second radio button. > > I needed to create a new MarkupContainer to wrap the group in and then I > target.add() that div and deselection of all items works well. > > So it looks like this: > > <span wicket:id="radioGroup1"> > <div wicket:id="radioGroup1Div"> > <input id="choice1" name="option1" type="radio" > value="01" wicket:id="choice1"> > <input id="choice2" name="option1" type="radio" > value="02" wicket:id="choice2"> > > > </div> > </span>
<div> inside <span> is invalid HTML. I know that one of those is not rendered at all because it is attached to the RadioGroup but ... can't you do radioGroup.setRenderBodyOnly(false) and remove the extra component ? > >>>@Chris: Can't you reset the RadioGroup's model so that none of the >>>Radios models match and re-render the whole group ? >> >>Bingo! I got it working. >> >>I wasn't adding the radio button to the target in the event handler. >> >>This is what works: >> >> group2Choice1Radio.add(new AjaxEventBehavior("onclick") { >> @Override >> protected void onEvent(AjaxRequestTarget target) { >> // there is no radio button for o1None so >>choosing this >> // deselects all radio buttons >> setGroup1Option(new Integer(MyModel.o1None)); >>target.add(group1Choice1Radio); >> target.add(group1Choice2Radio); >> } >> }); >> >>Using this option I need to target.add() for each individual radio >>button in the group I want to have deselected. >> >>I tried using the RadioGroup object as the component added to the > target >>like: >> >>target.add(option1Group); >> >>but got: >> >>Last cause: Ajax render cannot be called on component that has >>setRenderBodyOnly enabled. Component: [RadioGroup [Component id = >>option1Group]] >> >>Which makes sense because the RadioGroup component's tags disappear > when >>the markup is rendered. >> >>Regards, >>Chris >> >>--------------------------------------------------------------------- >>To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org >>For additional commands, e-mail: users-h...@wicket.apache.org > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org