WordPress.org

Ready to get started?Download WordPress

Forums

Fast Secure Contact Form
[resolved] Input Mask Possible? (3 posts)

  1. kirkward
    Member
    Posted 1 year ago #

    I am creating an "Extra Field" to receive telephone number input.

    Is there a way to do an input mask so that when a person enters their numeric phone number, it will be formatted properly in the input box?

    I can't find a solution using CSS, and I don't know RegEx. I can copy and paste.

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

  2. Mike Challis
    Member
    Plugin Author

    Posted 1 year ago #

    yes you can use the regex feature for this
    as described on the extra field help page
    http://www.fastsecurecontactform.com/how-to-add-extra-fields

    Use to validate if form input is in a specific format. Example: If you want numbers in a text field type but do not allow text, use this regex: /^\d+$/ Can be used for text, textarea, date and password field types.

    here is a pattern you can use for telephone numbers in the US
    /^(\(\d{3}\)[- ]?|\d{3}[- ])?\d{3}[- ]\d{4}$/

    Description
    US telephone pattern. Optional area code with or without '()'. If area code has parentheses then it is optionally followed by - or space. If no parentheses then it must be followed by - or space. Number must be separated by either a space or -.
    Matches
    (555)555-5555 | (555) 555-5555 | 555-5555
    Non-Matches
    5555555555 | 555.555.5555 | (555 555-5555

  3. kirkward
    Member
    Posted 1 year ago #

    Thanks, That helps a lot!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic