Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
item. setOptions(option) not working
Sachin_Gajanan
Hi,
I want to change the options of a select depending on value of some other select . Suppose we have two select one containing a list of regions say north,south,east and west. And other select containing important cities in those regions, for example if north is selected in first select i want to populate the second select field with cities of north, simlarly if south is selected i want to populate the secong select field with cities of south. Iam using my below code which is written in an eventhandler for "onItemChange" for the first select containing the four regions.
function populateCities(regitem)
{
var currentregion=regitem.getOptions()[regitem.getValue()].text;
var citiesitem=IWDatacapture.getItem("/cities");
if(reg=="south")
{
myoptions=new Array();
myoptions[0]=new Option("madras","madras",false,false);
myoptions[1]=new Option("tirupati","tirupati",false,false);
myoptions[2]=new Option("xyz","xyz",false,false);
citiesitem.setOptions(myoptions);
}
........................
..........................
.........................
}
This is not working, can any body suggest a solution !
Find more posts tagged with
Comments
iw_store
Hi,
Your Code Seems Ok, Not working means what Error It is Giving.
Sachin_Gajanan
means the setOptions(option) function i have tried in other code also but may be that is not executing
LooseCannon
You have a variable in the if named 'reg', is this declared globally?
I'm guessing it's a typo and should be 'currentregion'.
sunsun
please post your dct. i probably know what you are missing.
var citiesitem=IWDatacapture.getItem("/cities");
HAS TO BE
var citiesitem=IWDatacapture.getItem("/YOUR_ROOT_CONTAINER/cities");
I think. if this works then ok otherwise post your dct.