- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Saturday - last edited Saturday
Hi Team,
In catalog variable field i need validation decimal point only 2 digit allow
eg
10.22
10.01
invalid
10.233
1.001
how to create this validation
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Saturday
Hello @Arun_Manoj
You can create a variable validation regex and use for your variable.
First open this module as showcased below:
Create a new record and provide your desired regex as showcased below:
Regex code:
^\d+(\.\d{1,2})?$
Now use this over your catalog variable created as showcased below:
Below is working of regex over portal with +ve and -ve test case.
If my response has helped you, hit the helpful button, and if your concern is solved, do mark my response as correct.
Thanks & Regards
Viraj Hudlikar.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Saturday
Hello @Arun_Manoj
You can create a variable validation regex and use for your variable.
First open this module as showcased below:
Create a new record and provide your desired regex as showcased below:
Regex code:
^\d+(\.\d{1,2})?$
Now use this over your catalog variable created as showcased below:
Below is working of regex over portal with +ve and -ve test case.
If my response has helped you, hit the helpful button, and if your concern is solved, do mark my response as correct.
Thanks & Regards
Viraj Hudlikar.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Saturday
Great Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Saturday
Helpful! Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Saturday
Hi @Arun_Manoj ,
I tried your problem it worked for me please check solution below
I created a variable called "Number" and added a OnChange Client Script on that variable please check below code
alert("Here called = " + newValue);
var regex = /^\d+(\.\d{1,2})?$/;
if (!regex.test(newValue)) {
alert("Please enter a valid number with up to 2 decimal places (e.g. 10.22).");
g_form.showFieldMsg('u_score', 'Please enter a valid number with up to 2 decimal places (e.g. 10.22).', 'error');
g_form.setValue('u_score', '');
}
Result:
Please mark my answer correct and helpful if this works for you
Thanks and Regards,
Sarthak
