- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-16-2024 06:51 PM
Hi All,
I have developed regex :^[0-8,\,]+([\.][0-9]{0,1}+)?$:- in this regex it allowing 0 to 8 with one decimal number like 7.8. 8.1 , 8.9. But it should be max 8.0 after that it should through the error (example : 8.1, 8.9 through error ). Can you help me to redevelop the regex.
Thanks ,
chandan
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-16-2024 07:19 PM
Hi @chandan31
You can try the below script in onchange client script
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
if (!newValue.match(/^(?:[0-7](?:\.[0-9])?|8(?:\.0)?)$/)) {
alert("he value must be between 0 and 8, with at most one decimal place, and the maximum value allowed is 8.0");
g_form.clearValue('number')
}
//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-16-2024 07:18 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-16-2024 07:21 PM
HI Harish,
It should allow maximum one decimal number like 7.8,6.7 or 3.2.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-16-2024 07:19 PM
Hi @chandan31
You can try the below script in onchange client script
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
if (!newValue.match(/^(?:[0-7](?:\.[0-9])?|8(?:\.0)?)$/)) {
alert("he value must be between 0 and 8, with at most one decimal place, and the maximum value allowed is 8.0");
g_form.clearValue('number')
}
//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-16-2024 07:31 PM - edited 05-16-2024 07:32 PM
Hi @chandan31
^(?:[0-7](?:\.\d)?|8(?:\.[0-9])?)$
Can you check with this .
Mark it Helpful and Accept Solution!! If this helps you to understand .