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

Question

Question

How do I mask social security number in forms?

asked on May 23, 2020

This is the script I currently have in the form but it does not work.  Any ideas?

 

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

0 0

Answer

SELECTED ANSWER
replied on May 25, 2020

If you set the input type attribute to password, you will get circles to mask the input entry in the field

Example 1, directly targeting the field

$(document).ready(function () {
$("#q7 input").attr("type","password");
});

Example 2 with ssn Class assigned to field

$(document).ready(function () {
$('.ssn input').attr("type","password");
});

4 0
replied on May 25, 2020

Thank you so much!  This works exactly how I wanted it to.

0 0

Replies

replied on May 25, 2020

Hi Armando,

The code you have here is trying to load a file from your Forms server. Your server's URL should replace the "formsservername" in the second line, so if your URL is "https://armandolaserfiche.com/Forms" it should be:

$.getScript('https://armandolaserfiche.com/Forms/js/jquery.mask.min.js', function () {

You could also use a public URL in case your server doesn't have the file / you can't get it to work:

$(document).ready(function () {
  $.getScript('https://cdnjs.cloudflare.com/ajax/libs/jquery.mask/1.14.16/jquery.mask.min.js', function () {
    $(".ssn input").mask("999-99-9999");
  });
});

 

Additionally, as Steve mentioned, you need to apply the "ssn" class to the field in the Advanced tab (or use the direct reference like "#q7").

2 0
replied on May 25, 2020

Thank you!  This worked as well.

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

Sign in to reply to this post.