Master Posted October 26, 2016 Report Share Posted October 26, 2016 I have a field keeping SSN numbers and I only want to show the last 4 digits and the rest to be starts. How can I do that? Quote Link to comment Share on other sites More sharing options...
MayMusic Posted October 26, 2016 Report Share Posted October 26, 2016 If you want to show the value in report page, add HTML Block and use the code below in source: <div id="sn[@field:Id]"></div> <script> var ssn = '[@field:SSNField]'; document.getElementById('sn[@field:Id]').innerHTML= "*****" + ssn.substr(ssn.length - 4); </script> "[@field:Id]" needs to be replaced with the field which is holding unique identifier and [@field:SSNField] with appropriate field. If you want to show the value in details page then you can add a virtual field (here we have Virtual1) and use the code below to the footer: <script> var ssn = '[@field:SSNField]'; document.getElementById('cbParamVirtual1').value= "*****" + ssn.substr(ssn.length - 4); </script> If you want this field to be editable you can add a Virtual Checkbox , update SSN, and set a Rule to hide Virtual 1 if Virtual 2 is checked and hide SSNField if Virtual2 is not checked. This way you can see the whole value and update. Quote Link to comment Share on other sites More sharing options...
cheonsa Posted February 19, 2021 Report Share Posted February 19, 2021 Hello, Sharing with you my solution to display only the last 4 digits of the credit card information in Details Page. Paste this in the Footer: <script> var account = document.getElementById('EditRecordCCNumber'); account.value = new Array(account.value.length-3).join('x') + account.value.substr(account.value.length-4, 4); </script> Replace CCNumber in EditRecordCCNumber depending on the correct field name in the Table. Using this code, you can directly change the value of the field without using Virtual fields and Rule. Quote Link to comment Share on other sites More sharing options...
NailDyanC Posted February 12, 2022 Report Share Posted February 12, 2022 Just to add, you may also consider this workaround: If you want to show the value in report page, add HTML Block and use the code below in source: <div id="sn[@field:Id]"></div> <script> var ssn = '[@field:CCField]'; document.getElementById('sn[@field:Id]').innerHTML= "*****" + ssn.substr(ssn.length - 4); </script> "[@field:Id]" needs to be replaced with the field which is holding unique identifier and [@field:Field] with appropriate field. Also, if you want to show the value in details page then you can add a virtual field (here we have Virtual1) and use the code below to the footer: <script> var ssn = '[@field:CCField]'; document.getElementById('cbParamVirtual1').value= "*****" + ssn.substr(ssn.length - 4); </script> Moreover, if you want this field to be editable you can add a Virtual Checkbox , update CC, and set a Rule to hide Virtual 1 if Virtual 2 is checked and hide CCField if Virtual2 is not checked. This way you can see the whole value and update. And you may also use the code below for Single Record Update DataPage and put the code inside the footer: <script> var ssn = document.getElementById('EditRecordCCNumber'); ssn.value = new Array(ssn.value.length-3).join('x') + ssn.value.substr(ssn.value.length-4, 4); </script> The last four number of the credit card will only be shown and numbers before it will be masks after you click the update button (this is using Single Record Update DataPage): Quote Link to comment Share on other sites More sharing options...
NailDyanC Posted November 29, 2022 Report Share Posted November 29, 2022 Just want to add, you may check this link for other workaround: Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.