Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

conditional drop down list bind with sqlserver database

Level 2
Level 2

Hi Experts,

                  I have a requirement of having conditional drop down list - for e.g. there are two drop downs adjacent to each other


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.

0 Replies
Level 2
Level 2

Hi Krish,

On Country dorp down exit event try the following.

if(this.rawValue == "India"){


    City.addItem(" ","0");



}else if (this.rawValue == "China"){


    City.addItem(" ","0");






Level 4
Level 4

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.addItem(" ","0");

    contractsubtype.addItem("box 2a","1")

    contractsubtype.addItem("box 2b","2");


else if(type.rawValue = "Text 2"){


    contractsubtype.addItem(" ","0");

    contractsubtype.addItem("box 2g","1")

    contractsubtype.addItem("box 2h","2");


Level 2
Level 2


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.