There are some components in wicket that seem to be associated with a form, but I can't get them to actually submit the form.
For example, I can create a "submitlink" or button and those components submit:
return new SubmitLink(id, form) {
@Override
public void onSubmit() {
this.setResponsePage(pageClass);
}
};
That works above.
I want to be able to perform a submit on a radio choice, on change. E.g.
new OnChangeHandler() {
@Override
public void onChange(final Object sel) {
// On submission, submit back to form
setResponsePage(Page.class);
}
// MY CONTAINER IS NOT A FORM BUT A CHILD OF A FORM (E.g. FORM -> PANEL -> RADIOCHOICE
public RadioChoice addRadioGroup(final WebMarkupContainer container, final Object modelObject,
final String groupName, final String propFieldName, final String [] optionsArr, final OnChangeHandler handler) {
final RadioChoice radioGroupYesNo = new RadioChoice(groupName, new PropertyModel(modelObject, propFieldName), Arrays.asList(optionsArr)) {
@Override
public boolean wantOnSelectionChangedNotifications() {
return (handler != null); /* When the handler is not null, enable on change */
}
@Override
public void onSelectionChanged(Object newSel) {
if (handler != null) {
handler.onChange(newSel);
} else {
super.onSelectionChanged(newSel);
}
}
};
container.add(radioGroupYesNo);
return radioGroupYesNo;
}
With the code shown above, the page refreshes, but I want to submit the form and do a page refresh.
I don't see where I could associate the form with the RadioChoice?