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

Question

Question

Is it possible to use Regular Expressions with Field Masks WITHOUT the jQuery plugin?

asked on April 8, 2020

I just discovered that field masks and regular expressions exist within forms (fairly new to the platform), and I'd love to make our forms a bit smarter with the autoformatting that this combination provides! Does anyone know if there's javascript code that can be used to do this without the use of the jQuery plugin, as the following article references?

https://www.laserfiche.com/support/webhelp/laserficheforms/9.1/en-us/forms/#FieldMasks.htm

 

Any and all help would be much appreciated. Thanks!

0 0

Replies

replied on April 8, 2020
$('.masked-phone input').change(function(e) {
  var x = e.target.value.replace(/\D/g, '').match(/(\d{3})(\d{3})(\d{4})/);
  e.target.value = '(' + x[1] + ') ' + x[2] + '-' + x[3];
})

I've been using this and adding a mask-phone class to each field I need masked. Modified for jQuery from this post: https://stackoverflow.com/questions/17651207/mask-us-phone-number-string-with-javascript

1 0
replied on April 9, 2020

Hey Brian! Thanks for the response. I'm very new to all of this, so could you please explain a bit further? I'm a bit confused on what parts of that need to be replaced. I'm sure a CSS class is part of that, as is the desired output format (which I'm assuming is the .masket-phone input field), but I'm not quite sure. Thanks again!

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

Sign in to reply to this post.