I'm running into an issue with a validation rule. I'm not a developer, but I'm determined to figure this out. Here's what I know so far.

A web-to-lead form is getting an error when posting a lead due to a validation rule for the phone number that is NOT( REGEX( Phone , "^[0-9]*"). I only enter numbers in the form and still get an error due to this rule. The phone line in the code of this form is <label for="phone">Phone</label><input id="phone" maxlength="40" name="phone" size="20" type="text" />
I've tried changing the type to phone, phonenumber, and tel which all get the same error.

I found another rule on the web that suggested using NOT( OR( ISBLANK(Phone), REGEX( Phone,"(\D?[0-9]{3}\D?)[\s][0-9]{3}-[0-9]{4}"))) and this worked, but then broke the production environment with the same error - "Only numbers are allowed in phone number."

With both of the Regex codes, I've entered both 1115554444 and 111-555-4444.

Has anybody run into a similar issue?

  • 1
    It'd be helpful to see some examples of the data being entered in this form field of yours. The first validation rule, for example, would complain about (555) 555-5555 because it only allows numbers (i.e. digits 0-9, which the (, ), -, and blank space are not). You should edit your question to include that information.
    – Derek F
    Jun 27, 2022 at 18:57
  • And it looks like you got similar feedback over on the same question you posed to SO.
    – Derek F
    Jun 27, 2022 at 19:08
  • With both of the Regex codes, I've entered both 1115554444 and 111-555-4444.
    – J Bree
    Jun 27, 2022 at 21:25

1 Answer 1


Try to use the validation rule below:

OR( OR( LEN( Phone ) <= 9 , LEN( Phone ) = 11, LEN( Phone ) = 12, LEN( Phone ) >= 14 ), NOT( OR( REGEX(Phone, "[0-9 ]+"), REGEX(Phone, "\+[0-9 ]+") ) ) )

  • I got a syntax error here; "\+[0-9
    – J Bree
    Jun 28, 2022 at 14:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .