- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-04-2021 02:13 AM
1.Test is a single line text variable. for example if i enter any ip range value(0.1.1.1 -25.5.5.5). its check the range and validate it.
2.if i enter incorrect(fsdfasf-11.1.1.1) ,(300.299.1.0) populate alert msg(please give valid ip range)
Solved! Go to Solution.
- Labels:
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-27-2021 12:11 AM
I have written client script to validate Ip range using ip address(IPV4) regex.
I divided two ip address as string separated by "-";
stored srt1 and srt2 to values in var a (used replace function to remove dots make it as a single string (a))
nd var b (used replace function to remove dots make it as a single string (b))
use if condition to compare first ip address (a) is not greater than or equal second ip address(b)
ex :if(a>=b)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-04-2021 02:52 AM
Hi Kranthi,
Try below onSubmit client script
function onSubmit() {
var ips = g_form.getValue('<field name of ip address>');
var ipList = ips.toString().split(/[ :;?!~,`"&|()<>{}\[\]\r\n/\\]+/);
var ipsLength = ipList.length;
var reg = /^(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})$/;
//Loop through ip address
for(i=0;i<ipsLength;i++){
if(!reg.test(ipList[i]))
{
g_form.showFieldMsg('<field name of ip address>','Please enter correct IP Address!','error');
return false;
}
else{
g_form.clearMessages();
g_form.hideFieldMsg('<field name of ip address>',true);
return true;
}
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-04-2021 04:08 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-27-2021 12:11 AM
I have written client script to validate Ip range using ip address(IPV4) regex.
I divided two ip address as string separated by "-";
stored srt1 and srt2 to values in var a (used replace function to remove dots make it as a single string (a))
nd var b (used replace function to remove dots make it as a single string (b))
use if condition to compare first ip address (a) is not greater than or equal second ip address(b)
ex :if(a>=b)