Reputation: 401
Is there a way to append JavaScript to Form's submit button inside onSubmit()
method? I want to be able to execute JavaScript right after finished actions inside overrided onSubmit()
. For example, AjaxButton
's onSubmit()
has an argument of AjaxRequestTarget
and appending JavaScript is done like this: target.appendJavaScript(script);
. How to achieve this goal with non-Ajax button?
Upvotes: 2
Views: 1323
Reputation: 1251
Executing script after execution of non-ajax button is rather hard. You can try adding AjaxBehaviour with 'onclick' parameter but that would either override buttons 'onSubmit()' or be executed before it.
Any reason you can't use AjaxSubmitButton or AjaxSubmitLink? Both have onSubmit(AjaxRequestTarget target, Form form) function, where you can add javascript.
Upvotes: 2