I have a few pages with a form. Every form has a AjaxButton
for submitting and a
<div wicket:id="feedback"></div>
for the feedback panel. Every form field is required and the FeedbackPanel
gets correctly filled with error messages from validators in case you leave one field out. The problem is those messages are displayed only if I hit "back" on the browser and then "forward" to see the page again, no matter where I place the feedback <div>
inside the page.
Until the back/forward gesture, no error message appear, but the form does not reach onSubmit()
(obviously, there are validation errors).
The problem is common to all of my pages that have a form and a FeedBackPanel
. All pages make use of Bootstrap 3.2.0, just in case that could make any difference.
Any clue about what's going on?
When you using Ajax, you have to add components, which you want to be updated into AjaxRequestTarget
. Components, which will be updated by Ajax must have predefined markup id.
So, you have to call setOutputMarkupId(true)
method for your FeedbackPanel
and override onError
method for AjaxButton
:
... = new AjaxButton (...) {
...
@Override
protected void onError(final AjaxRequestTarget target, final Form form) {
/*here add your feedback panel to be updated via ajax*/
target.addComponent(feedbackPanel);
}
}
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments