Set Select Box value with yes/no variable.

John Snow1
Kilo Expert

Hello,

I am working on a Catalog Client script that will automatically select a choice from a list select box when a separate yes/no variable is toggled to "Yes" I used an alert to verify that my IF statement is working, and it seems to be working fine. The issue I am having is with the g_form.setValue(). I have tried using the text option that is in the choice list and the value and have had no luck with automatically changing the choice selection.

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

   //Type appropriate comment here, and begin script below
   if (g_form.getDisplayValue('u_hasData') == "yes") 
	   {
		   alert(g_form.getDisplayValue('u_hasData')); 
		  g_form.setValue('pre_disposal', 'IT');
	   }
}

 

 

any suggestions?