I want to validate the field for US format phone number(478-857-4578). I used the below code, it works fine for all but one scenario.

If I enter only 4 digit number or below than, the error message

The validation formula has evaluated to an error

is displayed.

But for all other wrong inputs, my custom error message

Please enter phone number in 214-587-5485 format

is displayed.

I wanted to display my custom error message for all invalid inputs. Do I need to change anything in formula?


    IF(ISERROR(FIND("-", [num],4)),
        (FIND("-", [num], 4) = 4)
    IF(ISERROR(FIND("-", [num],8)),
        (FIND("-", [num], 8) = 8)
    IF(ISERROR(1*CONCATENATE(MID([num], 1, 3), MID([num], 5, 3), MID([num], 9, 4))),
            1*CONCATENATE(MID([num], 1, 3), MID([num], 5, 3), MID([num], 9, 4)) > 1000000000,
            1*MID([num], 1, 3) <> 911,
            1*MID([num], 5, 3) <> 911

This is not validation, but you can use input mask by adding jquery on newform of list

Below is the script:

<script language="javascript" src="http://code.jquery.com/jquery-1.4.2.min.js" type="text/javascript" ></script>
<script language="javascript" src="http://jquery-joshbush.googlecode.com/files/jquery.maskedinput-1.2.2.min.js" type="text/javascript" ></script>
<script language="javascript" type="text/javascript">
   $("input[title='Phone']").mask("(999) 999-9999? Ext.99999");

For your requirement, you can replace with below line:


For reference: Input Mask on Textbox


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.