Hi Experts,
I have a requirement of having conditional drop down list - for e.g. there are two drop downs adjacent to each other
country
city - based on the selection for country appropriate state for that country selected from the drop down
for e.g. we have two country China and India
Country - India China
City - (Mumbai , Delhi (belongs to country India)) and (Beijing, Shanghai (belongs to country China))
So requirement is when user selects India as country from drop down for country he should only get Mumbai and Delhi as drop down value for city and not Shanghai & Beijing
Similarly when he chooses China he should get city drop down values as Shanghai & Beijing and not (Mumbai and Delhi).
Please provide a sample scripting code. Country is bound by dynamic scripting.
Views
Replies
Total Likes
Hi Krish,
On Country dorp down exit event try the following.
if(this.rawValue == "India"){
City.clearItems();
City.addItem(" ","0");
City.addItem("Mumbai","1");
City.addItem("Delhi","2");
}else if (this.rawValue == "China"){
City.clearItems();
City.addItem(" ","0");
City.addItem("Beijing","1");
City.addItem("Shanghai","2");
}
Regards
Shan
I tried this for my form but for some reason it won't work if I use a double == it only works if I use a single =, but it doesn't populate the 2nd drop down correctly. It is as if it disregards what the raw value is and just populates the 2nd drop down with the information associated with the top selection with the drop down. So regardless if I choose Text 1 or Text 2 in my drop down I always get box 2a and 2b. Any ideas?!?
var type = Contracttype.rawValue
var subtype = contractsubtype.rawValue
if(type.rawValue = "Text 1"){
contractsubtype.clearItems();
contractsubtype.addItem(" ","0");
contractsubtype.addItem("box 2a","1")
contractsubtype.addItem("box 2b","2");
}
else if(type.rawValue = "Text 2"){
contractsubtype.clearItems();
contractsubtype.addItem(" ","0");
contractsubtype.addItem("box 2g","1")
contractsubtype.addItem("box 2h","2");
}
Views
Replies
Total Likes
Jodi,
I know this is a old reply but i thought I give you some pointers.
Reviewing your code, I noticed the if statement is a little off. you state in the variable it is type is "Contracttype.rawValue", so in your beginning if statement, your saying Contracttype.rawValue.rawValue = "text1".
it should be ~ if (type == "text1"){
I assume you know the difference between rawValue and formattedValue. anyway, i think the blank is what is hurting you also when it comes to the add item.
all if statements should contain two equals signs.
Views
Replies
Total Likes