I am trying to change the selected switch in a Wicket RadioGroup during AjaxEventBehavior, but cannot figure out how to do this. In particular, when a user enters text in a text box, I want to change the selected radio button to one, which I will indicate. How do you do this?
Here is what I still have (it falls on addComponent):
myRadioGroup = new RadioGroup("MyNewGroup", new PropertyModel(getPojo(), "selectedGroup")); Radio internalRadio = new Radio("InternalDirectoryNumber", new Model("Internal")); myRadioGroup .add(internalRadio); Radio externalRadio = new Radio("OtherMobileNumber", new Model("External")); myRadioGroup .add(externalRadio); TextField myTxtField= new TextField("TextBoxPrivateNumber", new PropertyModel(getVoiceItem(), "privateMobilePhone")); myTxtField.add( new AjaxEventBehavior( "onKeyUp" ) { @Override protected void onEvent(AjaxRequestTarget target) { Component component = target.getPage().get("myForm:MyNewGroup").setDefaultModelObject("External"); target.addComponent(component);
Here is an abandoned exception. java.lang.IllegalArgumentException: cannot update a component that does not have setOutputMarkupId set to true. Component: [MarkupContainer [Component id = myRadioGroup]]
What is the right way to do this? I do not find much documentation on the gate for this online.
source share