Author Topic: Problem with Phone validation  (Read 1756 times)

stevejacobsen

  • Pro Enterprise
  • Newbie
  • *
  • Posts: 46
    • View Profile
Problem with Phone validation
« on: February 06, 2017, 04:48:49 am »
I'm trying to validate a phone number but it keeps giving me a validation error. I tested the regex on regex101.com.

Quote
        {title: "Cell", width: 150, dataIndx: "cell", align: "center", dataType: "string",
            validations: [
                {type: 'regexp', value: "\([0-9]{3}\) [0-9]{3}-[0-9]{4}$", msg: "That does not appear to be a valid US phone number in the format (712) 555-1212!"},
            ]
        },

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6309
    • View Profile
Re: Problem with Phone validation
« Reply #1 on: February 06, 2017, 11:13:56 pm »
Please assign a regular expression object to value as below:

Code: [Select]
  value: /^\([0-9]{3}\)\s[0-9]{3}-[0-9]{4}$/