Short Site Title – no special characters or spaces, 15 chars max, mandatory i. If special characters

nikhil_anand
Giga Contributor

In catalog Client Script where in service portal Short Site Title – no special characters or spaces, 15 chars max, mandatory. If special characters or spaces are put in, please alert the user that these are not allowed and remove them automatically.

1 REPLY 1

Alex Tod1
Kilo Sage

Hello @nikhil_anand,

For this you can add a client script of the onChange type, your code should look something like this:

 

function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
   return;
}

if( newValue.indexOf('@')> -1 || newValue.indexOf(',')> -1 || newValue.indexOf('/')> -1 || newValue.indexOf('\\')> -1 || newValue.indexOf('.')>-1 || newValue.toString().length>15 || newValue.indexOf(' ')>-1){
   alert('Please re-enter a valid title. Special characters such as \\ , @ . / are not allowed.');
   g_form.setValue('title_name', '');

}

 

If you know other special characters or have other conditions, you can add them in if