remove phone number validation

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • livewire
    Senior Member
    • Nov 2016
    • 100

    remove phone number validation

    Hi

    im trying to add a / for certain phone numbers.. But it doesn't save the phone number and throws an validation error. how do i allow slashes added to the phone numbers?
  • emillod
    Active Community Member
    • Apr 2017
    • 1405

    #2
    Hello
    instead of slash, you should use for example x.
    Only digits, latin letters and characters -+_@:#(). are allowed

    Comment

    • item
      Active Community Member
      • Mar 2017
      • 1476

      #3
      Hi,
      maybe :




      i think you can create a custom metadata/app/regExpPatterns.json
      and put :

      PHP Code:
           "phoneNumberLoose": {   "pattern": "[0-9A-Za-z_@:#\/\\+\\(\\)\\-\\. ]+"   },  
      not tested.
      If you could give the project a star on GitHub. EspoCrm believe our work truly deserves more recognition. Thanks.​

      Comment


      • telecastg
        telecastg commented
        Editing a comment
        Excellent solution item

        I did not test the regExp pattern either because I am totally ignorant about them, but just to compliment the answer, the new metadata file should be located
        at custom/Espo/Custom/Resources/metadata/app/regExpPatterns.json

      • item
        item commented
        Editing a comment
        You are welcome telecastg
        i have just added in original pattern \/ just after the #


        i don't really know regex. . only basic.. but i copy/past expression in https://regex101.com/
        and the result is :

        Match a single character present in the list below [0-9A-Za-z_@:#\/\\+\\(\\)\\-\\. ]
        + matches the previous token between one and unlimited times, as many times as possible, giving back as needed (greedy)
        0-9 matches a single character in the range between 0 (index 48) and 9 (index 57) (case sensitive)
        A-Z matches a single character in the range between A (index 65) and Z (index 90) (case sensitive)
        a-z matches a single character in the range between a (index 97) and z (index 122) (case sensitive)
        _@:# matches a single character in the list _@:# (case sensitive)
        \/ matches the character / with index 4710 (2F16 or 578) literally (case sensitive)
        \\ matches the character \ with index 9210 (5C16 or 1348) literally (case sensitive)
        + matches the character + with index 4310 (2B16 or 538) literally (case sensitive)
        \\ matches the character \ with index 9210 (5C16 or 1348) literally (case sensitive)
        ( matches the character ( with index 4010 (2816 or 508) literally (case sensitive)
        \\ matches the character \ with index 9210 (5C16 or 1348) literally (case sensitive)
        ) matches the character ) with index 4110 (2916 or 518) literally (case sensitive)
        \\-\\ matches a single character in the range between \ (index 92) and \ (index 92) (case sensitive)
        . matches a single character in the list . (case sensitive)
        Global pattern flags
        g modifier: global. All matches (don't return after first match)
        m modifier: multi line. Causes ^ and $ to match the begin/end of each line (not only begin/end of string)
    Working...