[richfaces-issues] [JBoss JIRA] (RF-11531) Client side validation: regexp ignores whitespace at the beginning

Brian Leathem (Commented) (JIRA) jira-events at lists.jboss.org
Wed Oct 19 15:09:45 EDT 2011


    [ https://issues.jboss.org/browse/RF-11531?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12635880#comment-12635880 ] 

Brian Leathem commented on RF-11531:
------------------------------------

The javascript regexp interpretation is actually correct.  It checks for the pattern matched within the input value, not starting with.

If you want it to start with, change the pattern to "^[a-z].*"

{code:title=RichAutocompleteBean.java patch}
--- application/src/main/java/org/richfaces/tests/metamer/bean/rich/RichAutocompleteBean.java	(revision 22827)
+++ application/src/main/java/org/richfaces/tests/metamer/bean/rich/RichAutocompleteBean.java	(working copy)
@@ -170,7 +170,7 @@
         this.value1 = value1;
     }
 
-    @Pattern(regexp = "[a-z].*")
+    @Pattern(regexp = "^[a-z].*")
     public String getValue2() {
         return value2;
     }
{code}
                
> Client side validation: regexp ignores whitespace at the beginning
> ------------------------------------------------------------------
>
>                 Key: RF-11531
>                 URL: https://issues.jboss.org/browse/RF-11531
>             Project: RichFaces
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>          Components: component-input
>    Affects Versions: 4.1.0.Milestone3
>            Reporter: Jan Papousek
>             Fix For: 4.1.0.Milestone4
>
>
> Let "[a-z].*" is expected regexp and input value is " a". The value shouldn't pass the validation, but it passes.
> This can be reproduced in Metamer:
> - http://localhost:8080/metamer/faces/components/richAutocomplete/csv.xhtml
> - http://localhost:8080/metamer/faces/components/richInplaceInput/csv.xhtml

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the richfaces-issues mailing list