
- 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 11:38 AM
The select box has its own question choices ( table: question_choice ).
It's used in a catalog item form:
- 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
11-02-2023 12:56 PM
Thanks @AshishKM !!
I managed to solve my problem with your solution, thank you very much.
Regards.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-02-2023 12:58 PM
Good to hear back, thanks for confirming, happy to help.
Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution