Ok - my new code looks as follows:
-----------------------------------------------------

RadioGroup sex = new RadioGroup("sex");
Radio male = new Radio("M", new Model(SexEnum.MALE));
Radio female = new Radio("F", new Model(SexEnum.FEMALE));

sex.add(male.add(new AjaxEventBehavior("onchange") {
     protected void onEvent(AjaxRequestTarget target) {
           // add your favorite component.
      }
});
sex.add(female.add(new AjaxEventBehavior("onchange") {
     protected void onEvent(AjaxRequestTarget target) {
           // add your favorite component.
      }
});

This seems to associate the right event with the radio buttons.

Having said that - I was curious - how would I distinguish between the
different radio buttons in a given radio group (between M and F , in
the above example ) to see which value has been chosen. Is there a
method in RadioGroup , that will given something like a current
selected radio model or something similar to that ?




On 7/5/08, Rakesh Sinha <[EMAIL PROTECTED]> wrote:
> I changed the code to be AjaxFormComponentUpdatingBehavior ("onclick")
>  - but it still does not seem to work ( though , onclick *is* the right
>  method to invoke from javascript ).
>
>  The generated HTML does not seem to contain the javascript invocation
>  for the particular event. I am suspecting something wrong with my html
>  code.
>
>
>  html:
>  ====
>
>  <wicket:container wicket:id="sex">
>        <td><input wicket:id="M" type="radio" />Male <input
>        wicket:id="F" type="radio" />Female</td>
>  </wicket:container>
>
>
> Would this be correct ?
>
>
>
>  On 7/5/08, Timo Rantalaiho <[EMAIL PROTECTED]> wrote:
>  > On Sat, 05 Jul 2008, Rakesh Sinha wrote:
>  >  > This does not seem to invoke the ajax code handler that I was
>  >  > expecting when I select an age in the front - end. Any idea what I am
>  >  > missing here.
>  >
>  >
>  > Check out which JavaScript event gets triggered on checking
>  >  the radio button. It might be onclick instead of onchange,
>  >  in which case new
>  >  AjaxFormComponentUpdatingBehavior("onclick") in place of
>  >  OnChangeAjaxBehavior should work.
>  >
>  >  Best wishes,
>  >  Timo
>  >
>  >
>  >  --
>  >  Timo Rantalaiho
>  >  Reaktor Innovations Oy    <URL: http://www.ri.fi/ >
>  >
>  >  ---------------------------------------------------------------------
>  >  To unsubscribe, e-mail: [EMAIL PROTECTED]
>  >  For additional commands, e-mail: [EMAIL PROTECTED]
>  >
>  >
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to