Is it possible to execute same Onchange catalog client script for two variables?

Km Sh
Tera Contributor

Hello Team

Actually - Onchange catalog client script works/execute for single variable right.

 

Is it possible to execute same Onchange catalog client script for 2 variables??

Any suggestions please?

 

Thanks,

Kareem

4 REPLIES 4

AshishKM
Kilo Patron
Kilo Patron

Hi @Km Sh , 

No, with the given OOTB setup its not possible, however you can duplicate the same for both variables.

 

-Thanks,
AshishKM


Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution

Km Sh
Tera Contributor

Hello Ashish,

Yeah, we can duplicate, but the output is setValue for another variable(Multi Line text), which is overwriting the value. I mean one Onchange script set the value ex: ab & another Onchange script set another value ex: cd where previous value is overwritten. I am expecting the output in a cascade format ex: ab cd 

Note: Onchange variable is a List collector

 

Thanks

Hi @Km Sh ,
Is the collector list fed by other collector lists?

 

Thank you

Hi @KarimullahS ,
Assuming it is, it would be simple enough to implement if you only want to ADD entries to the combined field:

 

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

   //set old combined data and newvalue to add in strings
   var currentCombinedCollector = g_form.getValue("combinedCollector").toString();
   var changedCollector = newValue.toString();

   //Set new value represented by oldvalue + newvalue;
   g_form.setValue("combinedCollector", (currentCombinedCollector ? currentCombinedCollector + "," + changedCollector : changedCollector));
}

 

Note the need to REMOVE entries would require more complex logic. Especially if your primary fields references the same table and aren't restricted to different dataset. Since you would need to manage duplicate entries scenarios.

 

Thank you