How can I get radio button choice "live" in wicket? I mean if I've a radio button with two choices A and B and I want to add an ajax behavior (on change, on update, whatever works) to the button so that if I chose A it happens something in the page, if I chose B happens something else. Can You help me?
Just add an AjaxFormChoiceComponentUpdatingBehavior to the RadioChoice: 
RadioChoice radioChoice = new RadioChoice("myRadio", choiceList);
radioChoice.add( new AjaxFormChoiceComponentUpdatingBehavior("onchange") { 
    protected void onUpdate(AjaxRequestTarget target) {
        // Ajax actions here
        System.out.println("The selected value is " + getComponent().getDefaultModelObjectAsString()));
    }
}  );
form.add(radioChoice);
The Model of the RadioChoice will already be updated when executing onUpdate. Remember to add to target all components that are to be refreshed via AJAX (and of course to set setOutputMarkupId(true) to them).
There's an online example with source code of what you're looking for here. The relevant source code file is this one.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With