Add options based on choices
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-06-2020 08:01 AM
Hi,
In a catalog item i have Multiple Choice field (New and old choices in multiple choice field)
In that catalog item i have multi row variable set(Accessing) in that there is a field access(Multiple choice field) and choices are Grade1 and Grade2..Now Req is :
Under New -> Accessing(multirow variable set)-> access : Should only have Grade1
Under Old-> Accessing(multirow variable set)-> access : Should have both Grade1& Grade2( As it is) Mandatory
I tried with on change client script :
g_form.clearOptions('access');
if(newValue=='New')
{
g_form.addOption('access','Grade1 ');
g_form.removeOption('access','Grade2');
}
else if(newValue=='Old')
{
g_form.addOption('access','Grade1 ');
g_form.addOption('access','Grade2');
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-06-2020 08:07 AM
Hi,
For multiple choice fields...I don't believe you're able to "addOption" for that...so do you mean select-box?
Either way, for addOption, the appropriate format is:
g_form. addOption(<fieldName>, <choiceValue>, <choiceLabel>, <targetIndex>);
With "targetIndex" being 1 or 2 or 3, etc. the order in which you want it to appear in your select-box list of choices.
Also for your "newValue"....ensure are using the actual value of the choice...so is it 'New' or 'new'?
Either way, you should have enough here to proceed successfully!
Please mark reply as Helpful/Correct, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-11-2020 03:47 PM
Hi,
I just wanted to check-in on this.
If my reply above helped guide you correctly, please mark it as Helpful & Correct.
Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-04-2021 04:39 AM
I do believe that addOption is not avaiable for Multiple choice variable.
Can you suggest me a way to add choices on a variable based on another variable.
For example i want to display the different states based on the country choice on a catalog item variable set.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-04-2021 05:31 AM
Hello,
Please create a new question on the forums and feel free to mention me
Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!