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

Question

Question

Masking Phone Number in Forms

asked on October 29 Show version history

I am following the steps below: 

 

Here is my setup (ps: TwoLinePerX is for another script I have and my issue remains with or without it in the CSS box):

Tried with and without the s after http.

 

This is what I get:

Same result trying this on our development server and our production server. It is enforcing the formatting rule but is not masking the phone number. 

0 0

Answer

SELECTED ANSWER
replied on October 29

This is what I like.  It works while they're typing.

 

function maskPhones() {
//  $(".phone input").prop("placeholder", "ex (555) 555-5555");
  $(".phone input").on("input", function (e) {
    let x = e.target.value.replace(/\D/g, "").match(/(\d{0,3})(\d{0,3})(\d{0,4})/);
    e.target.value = !x[2] ? x[1] : "(" + x[1] + ") " + x[2] + (x[3] ? "-" + x[3] : "");
  });
};

$(document).ready(function() {
  maskPhones();
});

 

0 0
replied on October 29

Using this script and removing the reg ex worked beautifully. Thanks a bunch!

0 0

Replies

replied on October 29

This post: Formatting in forms - Laserfiche Answers provides a great JS that I use on our Classic.  Slightly different script but gives you the result you need.

1 0
replied on October 29

This is so much easier to implement in the new Forms Designer.

0 0
replied on November 8 Show version history

I have been using the Classic Designer and am now playing around with the new Form Designer, I am not seeing the "Use an input mask" option. Am I missing a location where this has to be turned on?  (V11)

0 0
replied on November 8

You will need to be on a minimum of Forms 11 Update 5 (11.0.2311.50553). Here is a video that might help.

https://youtu.be/2AjYkFO_dAc

0 0
replied on November 8

What version of Forms are you using?  Forms 11 Update 5 which I'm using that has this feature is 11.0.2311.50564.

 

 

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

Sign in to reply to this post.