Automatically select checkbox if other checkbox is selected

Filip6
Tera Contributor

Hi there,

I have some difficulties to set up one of the catalog item and I would like to ask for help if possible.

I've created the item with multiple checkbox A, B, C, D, E, F, G

I need to configure this item so when C is selected, checkbox B is automatically selected too or when G is selected, checkbox B and C are auto selected and no editable. 

Each of the checkbox have variables and I tried to create a script to meet my expectation but no luck so far. 

Thanks for your time. 

6 REPLIES 6

Brandon Barret1
Mega Sage

I would accomplish this with a Catalog UI Policy. First with the condition builder, state if FarmMapping variable is equal to true and then set the BingMaps var to true. You could also then reverse the checking if the FarmMapping box is unchecked. 

Below is a task I had to preform with a "business card" checkbox that set a title field to mandatory when it was checked. I built my condition here, and then set the other field state via script in the "script" tab.

 

find_real_file.png

Kunal Varkhede
Tera Guru

Hello

It can be done using Catalog Client Script with OnChange type. you can use following script for automatic selection of your checkbox.

 

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

return;

}

if(newValue == "true")
{
//g_form.addInfoMessage("checked A");
g_form.setValue('b', "true");
}

if (newValue == "false")

{

    if (g_form.getValue("A") == "false" && g_form.getValue("C") == "false" && g_form.getValue("D") == "false") {

                      g_form.setValue('B', "false");

 

              }

 

 


}

find_real_file.png

find_real_file.png

 

IF This is helpful to you Then mark It as correct or helpful.