You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by ad...@apache.org on 2023/10/23 08:18:12 UTC
[wicket] branch master updated (2dca294c90 -> 653d31b115)
This is an automated email from the ASF dual-hosted git repository.
adelbene pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/wicket.git
from 2dca294c90 Bump org.jacoco:jacoco-maven-plugin from 0.8.10 to 0.8.11 (#686)
new 00c5905cc7 Trigger client side validation when using SubmitLinks
new 653d31b115 Fall back to jQuery event triggering if requestSubmit() is not available
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js | 16 ++++++++++++++++
.../java/org/apache/wicket/markup/html/form/Form.java | 5 +++--
2 files changed, 19 insertions(+), 2 deletions(-)
[wicket] 01/02: Trigger client side validation when using SubmitLinks
Posted by ad...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
adelbene pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/wicket.git
commit 00c5905cc720aa4466e390d6e4931a0a911aedf7
Author: Andreas Svanberg <an...@mensa.se>
AuthorDate: Thu Oct 19 18:25:40 2023 +0200
Trigger client side validation when using SubmitLinks
---
.../src/main/java/org/apache/wicket/markup/html/form/Form.java | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/Form.java b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/Form.java
index fc96861270..24d86ba699 100644
--- a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/Form.java
+++ b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/Form.java
@@ -578,7 +578,8 @@ public class Form<T> extends WebMarkupContainer
* @param submitter
* the submitter
* @param triggerEvent
- * When true, the form will be submited via a javascript submit event, when false via
+ * When true, the form will be submitted via standard form submission ({@code requestSubmit()})
+ * including client side validation and firing a javascript submit event, when false via
* the {@code submit()} method.
* @return the javascript code that submits the form.
*
@@ -599,7 +600,7 @@ public class Form<T> extends WebMarkupContainer
if (triggerEvent)
{
- buffer.append("Wicket.Event.fire(f, 'submit');");
+ buffer.append("f.requestSubmit();");
}
else
{
[wicket] 02/02: Fall back to jQuery event triggering if requestSubmit() is not available
Posted by ad...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
adelbene pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/wicket.git
commit 653d31b1154450626fc8c4047a6b25007924bf90
Author: Andreas Svanberg <an...@mensa.se>
AuthorDate: Fri Oct 20 13:46:04 2023 +0200
Fall back to jQuery event triggering if requestSubmit() is not available
---
.../org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js | 16 ++++++++++++++++
.../java/org/apache/wicket/markup/html/form/Form.java | 2 +-
2 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js b/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js
index 7eaa51a96e..1f29dbc0c7 100644
--- a/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js
+++ b/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js
@@ -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
*/
diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/Form.java b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/Form.java
index 24d86ba699..652a04beca 100644
--- a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/Form.java
+++ b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/Form.java
@@ -600,7 +600,7 @@ public class Form<T> extends WebMarkupContainer
if (triggerEvent)
{
- buffer.append("f.requestSubmit();");
+ buffer.append("Wicket.Event.requestSubmit(f);");
}
else
{