- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-05-2022 11:30 AM
Hi everyone,
I am just starting out to learn about the platform and I need a bit of help. Can anyone tell me how to include a "/" as a mask of a field ?
Example:
If an User inputs the number 20221111, I want to make it so that a non-admin user sees the field masked in the following way (2022/11111).
Also, I want to make it so that while the User is typing the number, the "/" already shows up.
Also, the record must be saved in the table without the "/".
Can anyone help me in regards to what is the best way to do this.
Thank you !
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-05-2022 09:12 PM
Step 1:
You can use the below onLoad client script to automatically add "/" after the user input the 4th character.
function onLoad() {
//Type appropriate comment here, and begin script below
g_form.getElement("<variable_name>").observe('input', function() {
var cur = g_form.getValue("variable_name");
if (cur.length == 4) {
g_form.setValue("variable_name", cur + "/");
}
});
}
Step 2: Use onSubmit client script to remove the "/" from the value or use BR to remove the value from the variable.
Thanks & Regards,
Vasanth
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-05-2022 09:12 PM
Step 1:
You can use the below onLoad client script to automatically add "/" after the user input the 4th character.
function onLoad() {
//Type appropriate comment here, and begin script below
g_form.getElement("<variable_name>").observe('input', function() {
var cur = g_form.getValue("variable_name");
if (cur.length == 4) {
g_form.setValue("variable_name", cur + "/");
}
});
}
Step 2: Use onSubmit client script to remove the "/" from the value or use BR to remove the value from the variable.
Thanks & Regards,
Vasanth

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2022 07:36 PM
Here goes the onSubmit Client Script to remove the' / ' (step 2):
function onSubmit() {
//Type appropriate comment here, and begin script below
var noBar = g_form.getValue('variable_name').replace(/\D/g,'');
g_form.setValue('variable_name',noBar);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-08-2022 07:52 AM
Hi Vasantharajan N,
I have below requirements from customer.
In Incident form if the end user updated personal information in the work notes section like Passport number or DL number (EX: DL1234567) I need to hide "1234567" from 1234567 to ####### using background script only can you please help me.