Hi All how to display popup message in catalog item hostname(one of the variable in catalog) contains less than 12 characters .popup message should display host name should contain atleast 12 characters
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-19-2022 07:13 PM
how to display popup message in catalog item hostname(one of the variable in catalog) if host name contains less than 12 characters popup message should display host name should contain atleast 12 characters

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-19-2022 07:52 PM
Hi there are 2 ways to do this
1. You can write a onSubmit clientscript for example below. Refer attach screenshot
function onSubmit() {
//get the value of host name
var hostName = g_form.getValue('host_name');
var length = hostName.length; //check the length
alert(length);
if (length <= 12) {
alert("Host name should contain atleast 12 character");
return false; //abort the submission
}
}
}
2. Write onchange client script and display the error message below the variable
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
//get the value of host name
var hostName = g_form.getValue('host_name');
var length = hostName.length;
alert(length);
if (length <= 12) {
g_form.showErrorBox("host_name","Host name should have atleast 12 char");
}
}
Harish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-05-2022 12:57 AM
Hi Harish,
i tried this code it is accepting more than 12 characters .
my requirement it should accept exactly 12 characters can you please help