Set all fields to None in catalog item

J_31
Kilo Sage

How to write a onchange catalog script to set all  other fields to --None--, if none is selected in the select box variable (I have chosen include none)

6 REPLIES 6

Danish Bhairag2
Tera Sage
Tera Sage

Hi @J_31 ,

 

Try this code in an onChange Client script.

 

Note : Create an onChange script n then add this code in it.

 

var selectedValue = g_form.getValue('your_select_box_variable'); // Replace with the actual variable name

 

    // Check if "None" is selected

    if (selectedValue == '') {

        // Set all other fields to '--None--'

        g_form.clearValue('enter_variable_name1');

g_form.clearValue('enter_variable_name2');

g_form.clearValue('enter_variable_name3');

    }

 

Thanks,

Danish

 

It’s a select box variable does it work 

@J_31  yes as u want other variables to set it to none. None as in no value selected by default, which is similar to clearing the value from the variable.

 

Thanks,

Danish

 

Tai Vu
Kilo Patron
Kilo Patron

Hi @J_31 

If there's no intricate logic requiring scriptings, you can utilize a UI Policy and configure it to clear the variable value in the UI Policy Action.

Sample below.

Timi_0-1701665330755.png

Timi_1-1701665335020.png

 

Cheers,

Tai Vu