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

  1. kirkward
    Posted 2 years 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.


  2. Mike Challis
    Plugin Author

    Posted 2 years ago #

    yes you can use the regex feature for this
    as described on the extra field help page

    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}$/

    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 -.
    (555)555-5555 | (555) 555-5555 | 555-5555
    5555555555 | 555.555.5555 | (555 555-5555

  3. kirkward
    Posted 2 years ago #

    Thanks, That helps a lot!

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Fast Secure Contact Form
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic