Skip to content

Commit

Permalink
Fall back to jQuery event triggering if requestSubmit() is not available
Browse files Browse the repository at this point in the history
  • Loading branch information
asvanberg authored and bitstorm committed Oct 23, 2023
1 parent 00c5905 commit 653d31b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2421,6 +2421,22 @@
}
},

/**
* Submits the given form using, if available, standard form processing
* including client-side validation and firing of SubmitEvent.
* If it is not available, uses jQuery event triggering to submit the form
* and send out the SubmitEvent.
*
* @param form {HTMLFormElement} form to submit
*/
requestSubmit: function(form) {
if (form.requestSubmit) {
form.requestSubmit();
} else {
jQuery(form).trigger('submit');
}
},

/**
* The names of the topics on which Wicket notifies
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,7 @@ public final CharSequence getJsForSubmitter(IFormSubmittingComponent submitter,

if (triggerEvent)
{
buffer.append("f.requestSubmit();");
buffer.append("Wicket.Event.requestSubmit(f);");
}
else
{
Expand Down

0 comments on commit 653d31b

Please sign in to comment.