- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-28-2022 09:28 PM - edited 10-28-2022 09:30 PM
Hi , I have a requirement that a variable tto be mandatory upon selection of any value for that select box variable and variable to become non-mandatory again if value is none . so , I have written below onchange catalog client script but variable is showing mandatory even when setting the selectbox value to none .
if (newValue != "") {
g_form.setMandatory("cat_variable_name", true);
}
if (newValue == "") {
g_form.setMandatory("cat_variable_name", false);
}
Please help me in this matter .
thanks & regards
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-28-2022 09:37 PM
Hi @Amit Dey1,
You can easily achieve using Catalog UI policy.
Condition as -
select_box_variable ISONEOF select all values -- (except - None)
UI policy actions -
cat_variable_name --> Mandatory ---> True
OR
Try this updated scripts -
if (newValue == "") {
g_form.setMandatory("cat_variable_name", false);
}
if (newValue == "value1" || newValue == "value2" || newValue == "value3" ) {
g_form.setMandatory("cat_variable_name", true);
}
Thanks,
Sagar Pagar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-28-2022 09:37 PM
Hi @Amit Dey1,
You can easily achieve using Catalog UI policy.
Condition as -
select_box_variable ISONEOF select all values -- (except - None)
UI policy actions -
cat_variable_name --> Mandatory ---> True
OR
Try this updated scripts -
if (newValue == "") {
g_form.setMandatory("cat_variable_name", false);
}
if (newValue == "value1" || newValue == "value2" || newValue == "value3" ) {
g_form.setMandatory("cat_variable_name", true);
}
Thanks,
Sagar Pagar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-28-2022 10:06 PM
Hi Sagar , that UI policy worked , thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-28-2022 10:11 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-28-2022 10:10 PM
Hi Amit,
This requirement can be achieved by using the Catalog UI Policy. Kindly refer the below screenshot for the Catalog UI Policy and Catalog UI Policy actions.
Kindly mark this answer as helpful if it has resolved the issue.
Thanks,
Harsha