We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 33657
    • 128 Posts
    [[!FormIt?  &customValidators=`isPhone` &validate=`phone:isPhone`]]



    then make a custom snippet called "isPhone"

    Done!

    <?php
    
    $value;
    
    $pattern = "/^\(?(\d{3})\)?[- ]?(\d{3})[- ]?(\d{4})$/";
    
    /*** try to validate with the regex pattern ***/
    if(filter_var($value, FILTER_VALIDATE_REGEXP, array("options"=>array("regexp"=>$pattern))) === false)
            {
            return $value;
            }
    ?>