gregh3269 commented on code in PR #243:
URL: https://github.com/apache/roller/pull/243#discussion_r4548065979
##########
app/src/main/webapp/WEB-INF/jsps/core/CreateWeblog.jsp:
##########
@@ -89,6 +89,27 @@
var saveButton;
$( 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
Review Comment:
As a test I updated the regex from roller.js validateEmail
`
/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
`
It works but now gets rejected up stream.
<img width="891" height="402" alt="image"
src="https://github.com/user-attachments/assets/eb33096c-5a0f-4bb6-bc4b-c36b2fc42517"
/>
So I guess it never worked. For simplicity just drop the client validation,
and fix up steam.
But its a struts issue
`
<validators>
<field name="bean.emailAddress">
<field-validator type="email">
<message key="CreateWeblog.error.emailAddressBad">unspecified
key</message>
</field-validator>
</field>
</validators>
`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]