Set all fields to None in catalog item
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā12-03-2023 06:05 PM
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)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā12-03-2023 06:47 PM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā12-03-2023 06:51 PM
Itās a select box variable does it work
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā12-03-2023 06:53 PM
@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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā12-03-2023 08:49 PM - edited ā12-03-2023 08:51 PM
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.
Cheers,
Tai Vu