Expand my Community achievements bar.

Populate text field based on Drop Down List choice

Avatar

Level 1

Can you populate a text field with data that corresponds to a choice on a drop down list?  I know you can do this between two drop down lists, but since there may be a paragraph or more text in the second field, it must auto grow.  I have included the code below that I am using to link two drop down lists.  It is certainly not the best way to do what I am trying, but I am quite new to this javascript stuff.  Thanks for any help!!

form1.WorkInstructions.DropDownList1::exit - (JavaScript, client)

if (this.rawValue == 1){this.parent.DropDownList2.selectedIndex = 0}

else           if (this.rawValue == 2){this.parent.DropDownList2.selectedIndex = 1}

                    else           if (this.rawValue == 3){this.parent.DropDownList2.selectedIndex = 2}

                                        else           if (this.rawValue == 4){this.parent.DropDownList2.selectedIndex = 3}

                                                            else           if (this.rawValue == 5){this.parent.DropDownList2.selectedIndex = 4}

                                                                                else           if (this.rawValue == 6){this.parent.DropDownList2.selectedIndex = 5}

                                                                                                    else           if (this.rawValue == 7){this.parent.DropDownList2.selectedIndex = 6}

                                                                                                                        else           if (this.rawValue == 8){this.parent.DropDownList2.selectedIndex = 7}

                                                                                                                                            else           if (this.rawValue == 9){this.parent.DropDownList2.selectedIndex = 8}

                                                                                                                                                                else           if (this.rawValue == 10){this.parent.DropDownList2.selectedIndex = 9}

                                                                                                                                                                                    else           if (this.rawValue == 11){this.parent.DropDownList2.selectedIndex = 10}

                                                                                                                                                                                                        else           if (this.rawValue == 12){this.parent.DropDownList2.selectedIndex = 11}

                                                                                                                                                                                                                            else           if (this.rawValue == 13){this.parent.DropDownList2.selectedIndex = 12}

                                                                                                                                                                                                                                                else           if (this.rawValue == 14){this.parent.DropDownList2.selectedIndex = 13}

                                                                                                                                                                                                                                                                    else           if (this.rawValue == 15){this.parent.DropDownList2.selectedIndex = 14}

                                                                                                                                                                                                                                                                                        else           if (this.rawValue == 16){this.parent.DropDownList2.selectedIndex = 15}

                                                                                                                                                                                                                                                                                                            else           if (this.rawValue == 17){this.parent.DropDownList2.selectedIndex = 16}

                                                                                                                                                                                                                                                                                                                                else           if (this.rawValue == 18){this.parent.DropDownList2.selectedIndex = 17}

                                                                                                                                                                                                                                                                                                                                          else           if (this.rawValue == 19){this.parent.DropDownList2.selectedIndex = 18}

                                                                                                                                                                                                                                                                                                                                                    else           if (this.rawValue == 20){this.parent.DropDownList2.selectedIndex = 19}

                                                                                                                                                                                                                                                                                                                                                              else           if (this.rawValue == 21){this.parent.DropDownList2.selectedIndex = 20}

                                                                                                                                                                                                                                                                                                                                                                        else {this.parent.DropDownList2.rawValue = ""}

0 Replies