How to mask a field on form

Nitesh Chandana
Kilo Expert

Hello,

  I need to mask field on the form as we mask on record producer by using mask type. I doesn't want to use password type.

Can anyone help me out??

Thanks,

Nitesh

1 ACCEPTED SOLUTION

Hello Nitesh,



From Istanbul and Jakarta version, If you use a password(encrypted type 2). it will automatically mask the field on service portal. there by you can decrypt that by the following code:



var Encrypter = new GlideEncrypter();


var encrypted = current.variable name;


var decrypted = Encrypter.decrypt(encrypted);


current.u_client_instance_password = decrypted;


current.update();


View solution in original post

10 REPLIES 10

gauravchoudhury
Tera Guru

Hi Nitesh,



Please refer to the below threads for your reference:



gupta_vipul013
Mega Expert

Hi Nitesh,



This can be easily handle by javascript. We just need to change the value of the type attribute to the "password".



Just write an Macro, below is the code and add it into the catalog form.



<?xml version="1.0" encoding="utf-8" ?>


<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">


<g:include_script src="jquery.min.jsdbx" />  


  <g:include_script src="jquery.mask.min.jsdbx" />  


  <script>  


    document.getElementById('u_snow_notes.u_question').type="password";       //put the ID of the field here.


  </script>  


</j:jelly>


hello vipul,


    I have already added it to catalog item. In record producer, we have type named mask. The code which is given by you is not working on form. Is there any other solution??


Hi Nitesh,



There is one more solution. You can use OnLoad Client script for the same and use the below code:



function onLoad() {


var gr = g_form.getControl('/*--- Variable Name --- */');


gr.type="password";


}



Please let me know, if it works.



Regards, Vipul