Is it possible to execute same Onchange catalog client script for two variables?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-13-2024 09:56 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-13-2024 09:58 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-13-2024 10:21 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-13-2024 11:10 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-13-2024 12:30 PM - edited 05-13-2024 12:31 PM
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