Ip address validation
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2023 04:11 AM
Hi Team,
we have ip address variable on catalog item.
I want add some validation like below.
10.05.07.20
10.08.10.20/24
after / - should be max 2 digits.
If there are more then 2 digit, user can't able to submit form.
How can I achieve this ?
please help me here.
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2023 04:18 AM
Hello @lucky24
Please create on Change Client script on that variable and write this code.
var ipAddress = g_form.getValue('variable_name');
var ipPattern = /^(\d{1,2}\.\d{1,2}\.\d{1,2}\.\d{1,2})(\/\d{1,2})?$/;
if (!ipPattern.test(ipAddress)) {
g_form.clearValue('variable_name');
}
Mark ✅ Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.