Clearing Record Producer variable values if a form section is unused

jmuomini
Mega Expert

Hi,

I have a lengthy record producer for submitting budget requests. At the end of one year they are asked if they want to submit a second year. If they check a field, they get a second set of variables. There is also an option for a third set of fields. A case came up where a user checked the field, entered one amount in year two, changed her mind, and unchecked the trigger field, but didn't clear the amount in a year two field, which caused our export file to be off.

Would a catalog client script be able to detect a change in this field from true to false and then erase the values in any associated variables prior to the form being submitted? If this is practical, an example of the syntax would be most helpful.

Thanks, Jim

2 REPLIES 2

boydenhartog
Kilo Explorer

You can use a catalog UI policy for this (you are probably already using one to show the extra fields for a 2nd/3rd year.
Make sure the 'Reverse if false' field is true and the 'Run Scripts' field is true on the catalog UI policy and use this code in the execute if false script:

function onCondition() {
//Clear the fields if 'No'
g_form.setValue('your_field', '');
g_form.setValue('your_field2', '');
}


Thanks. This is very helpful and will make a good addition to my bag of tricks.