You are viewing limited content. For full access, please sign in.

Question

Question

Specific Field Format

asked on December 15, 2017

I have a Credit Card field. Is it possible to have a required format for the field be ####-####-####-#### (with the dashes)?

Additionally, I have a Phone # field. Is it possible to have a required format for the field be ###-###-#### (with the dashes)?

1 0

Answer

APPROVED ANSWER SELECTED ANSWER
replied on December 15, 2017

Hi Dontae,

 

You can achieve this by applying regular expressions to the Advanced Options of the desired fields fields. This would require the user input to match your desired formats.

 

For the credit card field, the RegEx would be:

\d{4}-\d{4}-\d{4}-\d{4}

For the phone number field, the RegEx would be:

\d{3}-\d{3}-\d{4}

 

In addition, I would recommend providing a tool tip or text above/below the field that tells the user what format to use when filling out these fields. That might look something like this:

2 0

Replies

replied on December 15, 2017

I like to use masking for that purpose.  There is an excellent guide in the support section: https://www.laserfiche.com/support/webhelp/laserficheforms/9.1/en-US/forms/#FieldMasks.htm

1 0
replied on September 16, 2019

Is there any way to format the phone number field so that it automatically add dashes without users having to add it themselves.

1 0
replied on December 15, 2017

Hi Dontae,

 

There are a few ways to achieve this.

 

Firstly, you can apply regular expressions to the fields. This would require the user input to match your desired formats.

 

For the credit card field, the RegEx would be:

\d{4}-\d{4}-\d{4}-\d{4}

For the phone number field, the RegEx would be:

\d{3}-\d{3}-\d{4}

 

Alternatively, you could apply JavaScript masking, which would apply the formatting automatically such that the user does not have to type the dashes.

 

1. Under the Advanced tab for each field, assign the following CSS classes:

     Phone Number Field: phone

     Credit Card Field: creditcard

 

2. Copy & Paste the following JavaSript into the form:

$(document).ready(function () {
  $.getScript('http://localhost/Forms/js/jquery.mask.min.js', function () {
  $(".phone input").mask("999-999-9999");
        });
     });

$(document).ready(function () {
  $.getScript('http://localhost/Forms/js/jquery.mask.min.js', function () {
  $(".creditcard input").mask("9999-9999-9999-9999");
        });
     });

 

replied on December 15, 2017

Yes. You can use a single line field and then on the Advanced tab of the field put in the required regular expression.

0 0
replied on May 23, 2018

Thank you for this question and answer!  Especially the mask.  Works like a charm.

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.