The CreatorCon Call for Content is officially open! Get started here.

why alert is not displaying in catalog client script?

Gamarawaji
Giga Contributor

Hi ,

 

when i try to give alert in catalog client script, it is not displaying anything.

please refer the code,

function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var request1 = g_form.getValue('request');

if(request1 =='Complete a job in IWS')
{
alert('Job should be only in Error state');
}
//Type appropriate comment here, and begin script below

}

 

Thank You.

16 REPLIES 16

Krupamayee
Kilo Expert

Hi Gamarawaji,

 

Three things to check here:

1)UI type in catalog client script is matching the same where you are checking

2)Whether is it triggering on change of the variable? To check whether the catalog client script is executing, first alert above the condition.

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

alert('yes the script is running');
var request1 = g_form.getValue('request');

if(request1 =='Complete a job in IWS')
{
alert('Job should be only in Error state');
}
//Type appropriate comment here, and begin script below

}

3)Check whether the correct checkboxes are turned true

find_real_file.png

Post checking all these if the issue is still not resolved,it would be great if you could paste the screenshots step by step by alerting the value(request1),it will be easy to figure out the issue.

 

Please mark the answer helpful, if it resolved your issue.

-Krupamayee.

 

Hitoshi Ozawa
Giga Sage
Giga Sage

Trying outputting content of variable "request1" to make sure it is the same. In JavaScript, uppercase and lowercase are treated as different.

Try the code below. If the second alert if displaying "false", make sure there is no special characters instead of a 

function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
  return;
}
var request1 = g_form.getValue('request');
var str = 'Complete a job in IWS';
alert(request1);
alert(request1 == str);
alert('request1 length:' + request1.length + ' string length:' + str.length);
if(request1 == 'Complete a job in IWS')
{
alert('Job should be only in Error state');
}
//Type appropriate comment here, and begin script below

}

If request field is a select box, the value of choices are defined in the "Value" field and not the "Text" field. Be sure to "Complete a job in IWS" is in the "Value" field as below.

find_real_file.png