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

Question

Question

masking a field in a table

asked on December 5, 2023

I have a table in a form. It is actually the second form in the process, and all the rows will have been already added at the point I need the masked field.

I have the following code.

$(document).ready(function () {
    $.getScript('https://servername/lib/jquery-mask/jquery.mask.min.js', function () {
	$(".code input").mask("99-999-99-99999");
	$('.Table tbody tr').on('blur,change',function(){
    $(".code input").mask("99-999-99-99999");
    	});
	});
});

I did change the server name to the appropriate address and I am able to get the first row to mask perfectly. I need help with the other rows.

I realize there are other posts explaining how to do this, but as a non-coder, I am thoroughly overwhelmed. I wish there was a way to make tables easier.

Anyway, please help me to fix the code so I can mask the related field in each row. I can ususally decipher other posts and figure out a solution, but his one has me stumped.

 

0 0

Answer

SELECTED ANSWER
replied on December 6, 2023

This code shows an example of using phone masking in a collection. It should be the same for other masking as well. (this code was written by @████████)

$(document).ready (function () {
  
  
  /*******************************************************************************/
  /*                     START: Setting up phone masking                                */
  /*                        More info at link below                                                */
  /* https://www.laserfiche.com/support/webhelp/laserficheforms/9.2/en-us/forms/#Forms/FieldMasks.htm?Highlight=jquery */
  /*******************************************************************************/ 

  /* Instructions at https://www.laserfiche.com/support/webhelp/laserficheforms/9.2/en-us/forms/#Forms/FieldMasks.htm?Highlight=jquery*/  
  /* NOTE: this ones pattern DOES NOT match the format found in the database */ 
  
	$.getScript('https://formsdev.ad.siumed.edu/Forms/js/jquery.mask.min.js', function () {
	$(".phoneMask1 input").mask("(999)999-9999 X9999999999"); 
        $(".phoneMask2 input").mask("999-999-9999 X9999999999");
      	
       	/* add mask to new rows in a collection */	
        $('.cf-collection-append').on('click',function(){
      	$(".phoneMask1 input").mask("(999)999-9999 X9999999999"); 
        $(".phoneMask2 input").mask("999-999-9999 X9999999999");
    	});    
      
       	/* add mask to new rows in a table */	
        $('.cf-table-add-row').on('click',function(){
      	$(".phoneMask1 input").mask("(999)999-9999 X9999999999"); 
        $(".phoneMask2 input").mask("999-999-9999 X9999999999");
    	});       
  
     
	});	
  
  /*******************************************************************************/
  /*                        END: setting up phone masking                                 */
  /*******************************************************************************/    

 
});

 

2 0
replied on December 6, 2023

Thank you. I was able to alter that to work. I thought I did something similar yesterday, but I guess not.

Appreciate the help.

0 0

Replies

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

Sign in to reply to this post.