Setting up validation for 10-digit US phone number

How to fix phone number validation failing on submit in ChronoForms.

Overview

The validation fails because the regex pattern lacks proper delimiters and the form type may be incorrect.
Add forward slashes before and after your regex pattern, then ensure the form is set to V6.1 type in the Settings tab.

Answered
ChronoForms v6
si sixdeuces 22 Oct, 2020
I've got a very simple contact form set up. I'm trying to use regex to validate a 10-digit US phone number in the format: 555-555-5555

I entered my regex into the regex field: ^[0-9]{3}\-[0-9]{3}\-[0-9]{4}$

Now, when using the form the field turns red as expected when typing, then back to white once the number is correctly filled.
However, when pressing submit, the validation fails and the error message is displayed to enter the number in the correct format.

What gives? I assume I have missed some option in the validation panel.

Setting up validation for 10-digit US phone number image 1[file=13398]Untitled-1.jpg[/file]
si sixdeuces 23 Oct, 2020
1 Likes
"Redo all your forms" isn't really the answer I was hoping for.

In any case, I was able to sort it out on my own.

The solution was two part:
  1. Use leading and trailing frontslashes on the regex, like: /^[0-9]{3}\-[0-9]{3}\-[0-9]{4}$/
  2. In the Setting tab, make sure the form is set to the V6.1 type
Hopefully that helps someone in the future.
Max_admin Max_admin 24 Oct, 2020
I was saying just rebuild this form!🙂
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
This topic is locked and no more replies can be posted.