- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-09-2024 03:41 PM
I'm looking for the best way to limit characters for a masked variable field.
Currently I'm using field type "masked" so it will be encrypted. I need to limit the below field characters.
1. User ID (limit 8 characters, both alphabetical and numeral)
2. Pin# (limit 4 numeral characters)
Any help would be greatly appreciated.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-09-2024 04:07 PM
You can try the below code
1: USERID
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
if (!newValue.match(/^[A-Za-z0-9]{0,8}$/)) {
alert("You need to enter 8 characters in USERID");
g_form.clearValue('userID')
}
//Type appropriate comment here, and begin script below
}
2: pin
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
if (!newValue.match(/^\d{0,4}$/)) {
alert("You need to enter 4 digits in PIN);
g_form.clearValue('pin')
}
//Type appropriate comment here, and begin script below
}
Thanks and Regards
Sai Venkatesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-09-2024 04:07 PM
You can try the below code
1: USERID
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
if (!newValue.match(/^[A-Za-z0-9]{0,8}$/)) {
alert("You need to enter 8 characters in USERID");
g_form.clearValue('userID')
}
//Type appropriate comment here, and begin script below
}
2: pin
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
if (!newValue.match(/^\d{0,4}$/)) {
alert("You need to enter 4 digits in PIN);
g_form.clearValue('pin')
}
//Type appropriate comment here, and begin script below
}
Thanks and Regards
Sai Venkatesh