WordPress.org

Ready to get started?Download WordPress

Forums

Fast Secure Contact Form
Phone number validation problem (7 posts)

  1. chzsoona
    Member
    Posted 2 years ago #

    Hi,
    First of all I really like that plug-in! It's great.
    Secondly, I'm having problem with phone number validation like “US format”. I want the validation with this format like “444-666-7776”. User shouldn’t be able to enter more digits in the phone text field. Like 10 digits for phone number and 2 dashes. I want minimum and maximum 12 digits.
    Right now I am using “Validation regex: /^\d+$/” or “Validation regex: ^[2-9]\d{2}-\d{3}-\d{4}$” for phone validation ( US format “ 444-666-7776” ) but it is not working. Display the error message “Invalid input.”
    Can anyone help me to solve this issue, I will appreciate that.
    Thanks

    http://wordpress.org/extend/plugins/si-contact-form/

  2. Mike Challis
    Member
    Plugin Author

    Posted 2 years ago #

    The extra field has these settings you can use:
    Validation regex: /\d{3}-\d{3}-\d{4}/
    Regex fail message: Please type your phone number like this xxx-xxx-xxxx

  3. chzsoona
    Member
    Posted 2 years ago #

    @Mike Thank you very much, now the required phone validation is working. once again thanks a lot.
    This plugin is awesome.

  4. dotdynamic
    Member
    Posted 1 year ago #

    Hi Mike,

    I've tried the above steps to create a phone validation field in the extra field section but no matter what Regex I enter the form returns the error message and does not submit the contact form.

    I am running the site in question locally with MAMP and using PHP 5.3.6. ANy suggestions on how to troubleshoot this?

    Cheers,
    Matthew

  5. Mike Challis
    Member
    Plugin Author

    Posted 1 year ago #

    Matthew, I cannot really help if your site is not where I can see it.

    Mike

  6. mrogero
    Member
    Posted 1 year ago #

    Hi Mike,

    I'm in Brazil (São Paulo) and use your awesome plugin! Here the people use the telephone numbers like this:

    11 7758-5146 or 11 7758 5146 or 11 7758.5146 - I need to let the people write in the camp symbols like: ) ( - . and the keyspace

    How can i do this?
    Thanks!
    Marcos Rogero

  7. Mike Challis
    Member
    Plugin Author

    Posted 1 year ago #

    Marcos a quick Google search found this
    /^([0-9]{2})?((\([0-9]{2})\)|[0-9]{2})?([0-9]{3}|[0-9]{4})(\-)?[0-9]{4}$/

    good luck

    Expression
    ^([0-9]{2})?((\([0-9]{2})\)|[0-9]{2})?([0-9]{3}|[0-9]{4})(\-)?[0-9]{4}$
    Description
    A simple expression to brazilian phone number code modified expression of Rafael, beyond international code, simple DDI without "+" 99 plus simple DDD (99) plus simple and whitout parentheses em trace, local phone number 3 or 4 digits plus "-" plus 4 digits.
    Matches
    552123236699 | 212323-6699 | 2323-6699
    Non-Matches
    [3434-3432] | [4(23)232-3232] | [55(2)232-232]

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic