- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-19-2022 10:22 PM - edited 12-19-2022 11:04 PM
I have two fields one is height and another is weight.
Height should only accept two numbers i.e one number before decimal and another is after decimal if not it should show some error.
Wight should only accept three numbers i.e two numbers before decimal and one number after decimal.
Note: I have taken integer as a field type!!
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-20-2022 12:39 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-19-2022 11:05 PM
Hi @Snow Guest ,
Here is sample script.
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var sdVal=g_form.getValue('short_description');
var splitVal=sdVal.split('.');
alert("First = "+splitVal[0]+"second = "+splitVal[1]);
var len=splitVal[1].length;
alert(len);
if(len>3){
alert('wrong decimal value');
}
else{
alert('correct decimal value');
}
}
Note - Make changes accordingly as per need.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-20-2022 12:39 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-20-2022 04:09 AM
May i know how to calculate integer field length in on change client script:
i did like var abc= g_form.getvalue('field name');
len= abc.length;
but len not taking actual length its not getting as per requirement