
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-20-2023 09:55 AM
Hi everyone,
I need to remove an option from a select box field in a catalog client script by using sys_choice table.
The current Client Script is this:
function onLoad() {
g_form.removeOption('what_do_you_want', 'seasonal_campaigns');
//Qual material?
g_form.removeOption('what_material', 'ear');
g_form.removeOption('what_material', 'gradio_banner');
g_form.removeOption('what_material', 'board');
g_form.removeOption('what_material', 'plastic');
}
It's working but I need to change this script by using the sys_choice table itself with the conditions for the reference field to read only the values that apply to the field.
How to achieve this?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-20-2023 10:22 AM
Hello @Leandro Oliveir
Use select box and choose reference field as a choice table
Then add reference qualifier using script include.
That will work.
Mark ✅ Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-20-2023 12:33 PM
Hi,
Thanks for details, both the select box pointing to question_choice table where there is no dependency setup like sys_choice table.
So first, create all qual material and qual problem label/value in Choice (sys_choice) table and setup dependency ( if applied ).
second, re-configure both the catalog item variable with sys_choice table, after catalog form showing the data from sys_choice table then apply the removeOption logic.
As I understand , the qual problem depends upon qual material, so write a onChange client script on qual material field and apply removeOption base on matched condition.
If( g_form.getValue("qual_material") == "putMatchedValueHere"){
g_form.removeOption("qual_problem" , "putTheRemoveValueHere" );
}
Let us know if it works for you or not.
Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-20-2023 10:16 AM - edited 10-20-2023 10:47 AM
Hi @Leandro Oliveir,
You can reference select box variable with sys_choice table, and use the onLoad() client script for conditional removeOption.
if( referenceField == "value"){
// apply the removeOption
g_form.removeOption("fieldName", "value");
}
Please try with if condition and share the issue if any.
Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-20-2023 10:22 AM
Hello @Leandro Oliveir
Use select box and choose reference field as a choice table
Then add reference qualifier using script include.
That will work.
Mark ✅ Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-20-2023 10:54 AM
Can you give some example? I didn't understand very well.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-20-2023 11:09 AM
Hi @Leandro Oliveir ,
Before we explain, can you share the detail of this select box , how is the current configuration.
either this select box has its own "Question Choices" ( table : question_choice ) or its pointing to System Choice ( table : sys_choice )
So if you are using question_choice then configure the sys_choice table and add those choice values in the sys_choice table. once all choice options are displaying on form then apply this removeOption via the onLoad() for conditional removalOptions.
For more help, please share the current setup.
Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution