You could add a custom Behavior to your FormCompoments. Let this
Behavior implement IValidator and it will get notice of a form submit
via #validate().
Hope this helps
Sven
On 02/14/2013 07:05 AM, Alex wrote:
Hi. I have AjaxFallbackButton on the form with defined onSubmit handler.
There also one custom AbstractBehavior added to the form. This Behavior
does some action with form's components (add event handlers for form's text
controls) and next should intercept form's onSubmit event to do some action
also. I try do this by adding form.AjaxFormSubmitBehavior(form, "onsubmit")
in this AbstractBehavior (do this by override the onConfigure). As a result
only AjaxFormSubmitBehavior.onSubmit handler of MyCustomBehavior invoked but
form button's onSubmit is ignored. What is wrong in this case? Is it
possible to add additional onSubmit action to the form via custom Behavior
like in my case?
Thanks for advice.
..................
form.add(new AjaxFallbackButton("submit",form) {
protected void onSubmit(AjaxRequestTarget target, Form<?>
aForm) {
// some mail form submit actions....
}
});
form.add(new MyCustomBehavior(feedbackPanel));
..............
public class MyCustomBehavior extends AbstractBehavior {
private FeedbackPanel feedback;
private Form form;
public MyCustomBehavior(FeedbackPanel feedback) {
this.feedback = feedback;
}
@Override
public void bind(Component component) {
super.bind(component)
// here initialize form ....
this.form = (Form) component;
}
@Override
public void onConfigure(Component component) {
// here form's text controls event handlers added via
AjaxFormComponentUpdationBehavior....
this.form.add(new AjaxFormSubmitBehavior(this.form, "onsubmit")
{
@Override
protected void onSubmit(AjaxRequestTarget target) {
// form submit action, set flag of some
operation
// this onSubmit handler should be invoked
after main form onSubmit handler
}
@Override
protected void onError(AjaxRequestTarget target) {
}
}
}
}
--
View this message in context:
http://apache-wicket.1842946.n4.nabble.com/Several-Form-onSubmit-is-it-possible-add-via-AbstractBehavior-tp4656347.html
Sent from the Users forum mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]