Expand my Community achievements bar.

Omitting drop down lists if a certain drop choice is chosen

Avatar

Level 1

I have 5 drop down lists that have data binding to populate a text field with number values (12-34-567-89012-34).  There is one choice in the first drop down list that will populate the entire numbered sequence.  If that drop down choice is chosen, I would like the next 4 drop downs to be skipped.  How can I do this?

Thank you,

Steve B

3 Replies

Avatar

Former Community Member

Something like this should work.

The attached form has three drop-downs (dd1, dd2 and dd3) each with a default value of "00". On dd1 exit event I check if "01" was chosen. If so I set dd2 and dd3 access to "protected" and their values to "00".

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

if (form1.page1.subform1.dd1.rawValue == "01") {

          form1.page1.subform1.dd2.access = "protected";

          form1.page1.subform1.dd3.access = "protected";

          form1.page1.subform1.dd2.rawValue = "00";

          form1.page1.subform1.dd3.rawValue = "00";

}

else {

          form1.page1.subform1.dd2.access = "";

          form1.page1.subform1.dd3.access = "";

}

The text field tf calculate event checks dd1. If dd1 is "01" is sets tf to "12-34-56". If dd1 is not "01" it concantenates dd1, dd2 and dd3.

// form1.page1.subform1.tf::calculate - (JavaScript, client)

if (form1.page1.subform1.dd1.rawValue == "01") {

          this.rawValue = "12-34-56";

}

else {

          this.rawValue = form1.page1.subform1.dd1.rawValue + "-" +

                    form1.page1.subform1.dd2.rawValue + "-" +

                    form1.page1.subform1.dd3.rawValue;

}

Steve

Avatar

Level 1

else {

          this.rawValue = form1.page1.subform1.dd1.rawValue + "-" +

                    form1.page1.subform1.dd2.rawValue + "-" +

                    form1.page1.subform1.dd3.rawValue;

}

I'm pretty sure this will all work out, once this part is fixed.  You see, I already have "-" in the bound values, so I'm guess that part is not needed AND the value that populates the text field is not the rawValue, but rather, the Bound value.  If you rewrite this with the changes, do you think it might work?

Thanks,

Steve B

Avatar

Former Community Member

Yes, it should. In the case of the form I attached the text values and the bound values are equal.

Steve