This is an automated email from the ASF dual-hosted git repository.

snoopdave pushed a commit to branch roller-6.1.x
in repository https://gitbox.apache.org/repos/asf/roller.git


The following commit(s) were added to refs/heads/roller-6.1.x by this push:
     new 4ec7fb28c Move validate email address to page rather than in global 
roller.js (#243)
4ec7fb28c is described below

commit 4ec7fb28cb31b5af70d48edf1bf7ba9bc8fe7200
Author: gregh3269 <[email protected]>
AuthorDate: Sun Nov 15 14:53:27 2026 +0000

    Move validate email address to page rather than in global roller.js (#243)
    
    * Move validate email address to page rather than in global roller.js
    
    * Fix spacing and remove tabs
    
    * Add change note.
    
    * Leave this fix out of CHANGES.md
    
    The errors it stops only show in the browser console on weblog pages, so 
readers and bloggers don't see a difference. Leaving the entry out also avoids 
a conflict with the other 6.1.8 changes that add that release's heading.
    
    ---------
    
    Co-authored-by: Greg Huber <[email protected]>
    Co-authored-by: Matt Raible <[email protected]>
---
 .../main/webapp/WEB-INF/jsps/core/CreateWeblog.jsp | 21 +++++++++++++++++++++
 app/src/main/webapp/theme/scripts/roller.js        | 22 ----------------------
 2 files changed, 21 insertions(+), 22 deletions(-)

diff --git a/app/src/main/webapp/WEB-INF/jsps/core/CreateWeblog.jsp 
b/app/src/main/webapp/WEB-INF/jsps/core/CreateWeblog.jsp
index b574975fc..2421603f6 100644
--- a/app/src/main/webapp/WEB-INF/jsps/core/CreateWeblog.jsp
+++ b/app/src/main/webapp/WEB-INF/jsps/core/CreateWeblog.jsp
@@ -90,6 +90,27 @@
 
     $( document ).ready(function() {
 
+        jQuery("form.validate-form").validate();
+        // Added method to check valid email address and add a custom error 
message
+        jQuery.validator.addMethod(
+            "regex",
+            function(value, element, regexp)  {
+                if (regexp && regexp.constructor != RegExp) {
+                    regexp = new RegExp(regexp);
+                } else if (regexp.global) {
+                    regexp.lastIndex = 0;
+                }
+                return this.optional(element) || regexp.test(value);
+            }
+        );
+        // Applied email rules to field with class name validate-email
+        jQuery( ".validate-email" ).rules( "add", {
+            minlength: 3,
+            maxlength: 255,
+            email: true,
+            regex: /^\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b$/i
+        });
+
         saveButton = $("#createWeblog_0");
 
         <s:if test="bean.theme == null">
diff --git a/app/src/main/webapp/theme/scripts/roller.js 
b/app/src/main/webapp/theme/scripts/roller.js
index 357fb5b8c..af640acfa 100644
--- a/app/src/main/webapp/theme/scripts/roller.js
+++ b/app/src/main/webapp/theme/scripts/roller.js
@@ -237,25 +237,3 @@ function actionErrors(html) {
         return error.textContent.trim();
     });
 }
-$(document).ready(function () {
-    jQuery("form.validate-form").validate();
-    // Added method to check valid email address and add a custom error message
-    jQuery.validator.addMethod(
-        "regex",
-        function(value, element, regexp)  {
-            if (regexp && regexp.constructor != RegExp) {
-                regexp = new RegExp(regexp);
-            } else if (regexp.global) {
-                regexp.lastIndex = 0;
-            }
-            return this.optional(element) || regexp.test(value);
-        }
-    );
-    // Applied email rules to field with class name validate-email
-    jQuery( ".validate-email" ).rules( "add", {
-        minlength: 3,
-        maxlength: 255,
-        email: true,
-        regex: /^\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b$/i
-    });
-});

Reply via email to