- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-13-2017 08:30 AM
So, I have set up a client script to remove options depending upon option set on a dependant field BUT after refreshing form the options selected are refreshing, the clearOptions function is running again
I'm sure this is simple but I can new to client scripts.
Here is my script, any advice is welcome. BTW this is on a scoped application.:
function onChange(control, oldValue, newValue, isLoading) {
if (newValue === 'In Store'){
g_form.clearOptions('complaint_sub_category');
g_form.setMandatory('complaint_sub_category',false);
g_form.setVisible('complaint_sub_category',false);
}
}
I suspect I need to state isLoading is false, i tried but obviously got it wrong
Thanks in advance
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-13-2017 08:33 AM
If you want the onChange client script to NOT run on loading (as an onLoad script does) Add these lines just inside the function.
if (isLoading)
return;
Can you help me understand why you want to clear all the options in the case of the In Store value? This shouldn't be necessary if you are hiding it anyway. Perhaps just use a g_form.setValue('fieldname', ''); to set it to empty instead.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-14-2017 03:09 AM
Thanks same awesome advise as legend Chuck but now I have another issue in the same area.
Creating records from a record producer is removing the chosen option from the record producer.
The two list match exactly so unsure why this is occurring.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-14-2017 03:13 AM
ignore that, forgot to map the field. face|palm