- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-28-2022 05:57 PM
I have a Yes/No variable, and the entry needs to get populated in 2 Yes/No read-only boxes farther down the form. Is there a simple script to make this happen?
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-02-2022 03:38 PM
Good point! It's a Yes/No field so there's only 2 choices so that'll do.
Need to check "Reverse if false" in that case.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-28-2022 07:15 PM
Hi
When do you want the values to be populated on those red only boxes?
Regards,
Shloke
Regards,
Shloke
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-01-2022 10:23 AM
So on the form, they select yes or no based on their financial position. Hitting yes or no should populate 2 yes/no variables farther down the form immediately, and change to 'No' if they select no to the original statement. The read only boxes have some label text explaining that "By hitting yes, you agree to law X, Y, and Z..." but its more or less a glorified way of showing they are agreeing to it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-03-2022 03:19 AM
Hi
You can handle this using a single On Change Catalog Client Script on your catalog item and use the script as below:
Script:
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
if(newValue == 'Yes'){
g_form.setValue('Variable1','Yes');
g_form.setValue('Variable2','Yes');
}else if(newValue == 'No'){
g_form.showFieldMsg('Variable name 1','Your message here','info');
g_form.showFieldMsg('Variable name 2','Your message here','info');
}
//Type appropriate comment here, and begin script below
}
Hope this helps. Please mark the answer as correct/helpful based on impact.
Regards,
Shloke
Regards,
Shloke

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-01-2022 05:56 PM
Even though it would be awkward to set values to fields using UI Policy, UI Policy can be used.
In this case, it would be necessary to create 2 UI Policies.
UI Policy 1:
Catalog Condition: field1 is Yes
Reverse if false: uncheck
function onCondition() {
var flg = g_form.getValue('field1');
g_form.setValue('field2', flg);
g_form.setValue('field3', flg);
}
UI Policy 2:
Catalog Condition: field1 is No
Reverse if false: uncheck
function onCondition() {
var flg = g_form.getValue('field1');
g_form.setValue('field2', flg);
g_form.setValue('field3', flg);
}
Execution results are the same as with Client Script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-02-2022 10:37 AM
Couldn't you make it on the same UI script, and have one piece on the Execute if True and one on the Execute if False?