Need to restrict a field to only 6 numeric digits
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-20-2013 08:48 AM
I can't seem to figure out how to restrict the asset tag to only 8 numeric digits. Can I get a bit of help with the script?
- 3,218 Views
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-20-2013 09:57 AM
You could do this with a client script (on submit)
function onSubmit() {
//Type appropriate comment here, and begin script below
var isnum = /^\d+$/.test(g_form.getValue('asset_tag'));
//alert("isnum: " + isnum);
if (!isnum) {
alert('Asset Tag should be only numbers.');
return false;
}
}
Server side is also possible.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-20-2013 10:04 AM
Not sure if the not more than 8 digits is a requirement but should it be then use the script below
function onSubmit() {
//Type appropriate comment here, and begin script below
var isnum = /^\d+$/.test(g_form.getValue('asset_tag'));
//alert("isnum: " + isnum);
if (!isnum) {
alert('Asset Tag should be only numbers.');
return false;
} else {
if (g_form.getValue('asset_tag').length > 😎 {
alert('Asset Tag should not contain more than 8 digits.');
return false;
}
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-08-2014 12:42 AM
hi Lauren.
I need to restrict a field (cost center) in catalog form to only numeric digits. I tried this script but sadly its not working. Can you help me?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-14-2017 03:58 AM
Hi Chinthuja ,
Did you get any solution for this? I am presently looking for same script.
Regards
Bandita Panigrahy