I have a form containing just a TextField and a Button. I notice that if I set the text field as required and click on the button, I get the appropriate feedback message.
However, when I have an AjaxButton instead (which is what I need, because I need to execute a callback method with an AjaxRequestTarget), I do not see the feedback message, unless I reload. Upon debugging, I noticed that the onSubmit method of the form is called (the onError too), but the onSubmit method of the AjaxButton is not.
What do you suggest I do so that I can see the feedback message and call a callback method?
Form<Void> form = new Form<>("form");
// added the textfield too
form.add(new AjaxButton("startButton") {
private static final long serialVersionUID = 1L;
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
// some action
target.add(this);
}
});
add(form);
<form wicket:id="form">
<table>
<tbody>
<tr>
<!-- some stuff -->
</tr>
<tr>
<td><input type="submit" wicket:id="startButton" class="roundedButton"></input></td>
</tr>
</tbody>
</table>
</form>
I can't see your entire code but you might need to add the FeedbackPanel to AjaxRequestTarget when onError is triggered.
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