Expand my Community achievements bar.

Linking two drop down list together

Avatar

Level 2

I have two drop downs list and I need to link them together for the user to only answer one of them and it won't allow an answer in the other or vice versa. How can I set that up?

If answer drop down list A then can't answer drop down list B

else

if drop down list B is answered then drop down list A can't be answered.

1 Reply

Avatar

Former Community Member

The attached contains two drop-down lists - apples and oranges. Each drop-down list has a default list item value of " ", thus the default index is 0 (zero). If you select a value other than default, the other drop-down list has it's access protected and the list item reset to 0 (zero). Conversely, if you select the default value, the other drop-down list becomes open or accessible.

// form1.page1.apples::exit - (JavaScript, client)


if (form1.page1.apples.selectedIndex != 0) {

  form1.page1.oranges.access = "protected";

  form1.page1.oranges.selectedIndex = 0;

}

else {

  form1.page1.oranges.access = "open";

}

// form1.page1.oranges::exit - (JavaScript, client)


if (form1.page1.oranges.selectedIndex != 0) {

  form1.page1.apples.access = "protected";

  form1.page1.apples.selectedIndex = 0;

}

else {

  form1.page1.apples.access = "open";

}

Steve