How to apply onchange catalog client Script to display the select box values based on another select box

Priya10
Kilo Contributor

please help me to display the select box values based on another select box in a catalog item form.

For example I want to write catalog client script of type onchange because when I select Neurologist in select box so available doctors should be those only whose specialization is Neurologist. 

1 ACCEPTED SOLUTION

Community Alums
Not applicable

Hi Priya,

You would require onchange client script on the select item variable; sample script below, just adjust or tweat as per your values:

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

g_form.clearOptions('request_type');

if(newValue == 'Card Swipe Unit'){

g_form.addOption('request_type', choicevalue, choiceLabel);
g_form.addOption('request_type', choicevalue, choiceLabel);

}

}

 

Mark my answer correct & Helpful, if Applicable.

Thanks,

Sandeep

View solution in original post

5 REPLIES 5

Service_RNow
Mega Sage

Hi

Please write catalog client script of type onchange field on "Select your required specialization"

For example:-

function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
// return;
}
var specialization = g_form.getValue('Select your required specialization');
g_form.clearOptions('select_docter');
if (newValue == 'darmatologists') {
g_form.addOption('select_docter', choicevalue, choiceLabel);
g_form.addOption('select_docter', choicevalue, choiceLabe2);

}
}

Mark Correct if this solves your issue and also mark Helpful if you find my response worthy.

Thanks,

Ram