- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-13-2014 11:44 PM
How to make choices in "choice list variable" visible based on the value of another variable field' in the same catalog item?
Solved! Go to Solution.
- Labels:
-
Performance Analytics
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-14-2014 12:31 AM
HI Feroz,
you can use onchange client script wherein you can see the value selevted in field A and depending on that you can add/remove options in field B(choice List Variable)
Use these functions for the same
g_form.addOption('<Variable Name>','<value>','<display value>'); // To add options to the dropdown
g_form.clearOptions('<variable name>'); //To remove all values from the dropdown
g_form.removeOption('<Variable Name>', '<value>'); // To Remove 1 option from the dropdown
g_form.setValue('<Variable Name>','<value>'); // To select by default any one of the options.
Hope this helps.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-14-2014 12:28 AM
Hello FEROZ,
You can refer the below thread
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-14-2014 12:31 AM
HI Feroz,
you can use onchange client script wherein you can see the value selevted in field A and depending on that you can add/remove options in field B(choice List Variable)
Use these functions for the same
g_form.addOption('<Variable Name>','<value>','<display value>'); // To add options to the dropdown
g_form.clearOptions('<variable name>'); //To remove all values from the dropdown
g_form.removeOption('<Variable Name>', '<value>'); // To Remove 1 option from the dropdown
g_form.setValue('<Variable Name>','<value>'); // To select by default any one of the options.
Hope this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-16-2014 01:46 AM
Hi Anurag, Thanks for your reply. I have used below script I am facing two issues
1. script is hiding subcategory field for category choice = phone.
2. subcategory is visible to all other category choices but without subcategory options mouse & Pendrive.
My requirement is when category field = phone then in subcategory mouse & pendrive should not be visible. And it should be visible to all other choices of category.
Catalog Client Script,
Onchange
Variable : Category
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var cat = g_form.getValue('category');
if(cat == 'phone'){
g_form.removeOption('sb_ctgry', 'mouse');
g_form.removeOption('sb_ctgry', 'pendrive');
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-16-2014 02:22 AM
Hi Feroz,
Try this code
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var cat = g_form.getValue('category');
if(cat == 'phone'){
g_form.removeOption('sb_ctgry', 'mouse');
g_form.removeOption('sb_ctgry', 'pendrive');
}
else
{
g_form.addOption('sb_ctgry', 'pendrive', 'pendrive');
g_form.addOption('sb_ctgry', 'mouse', 'mouse');
}
}