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
BedrockMission!

Learn More

View all

Sign in to view all badges

Dynamically Generate Fields

Avatar

21-11-2008

I am new to Life Cycle but am trying to come up with what code I would use to automatically generate certain fields based upon what is entered into a drop-down list. For instance I would have a drop down list with Item 1, Item 2, and Item 3. If Item 1 was chosen for example text field 1 and 3 would show. If Item 3 were chosen text field 2 would show. If Item 2 was chosen text field 4, 5, and 6 will show. Can anyone help me out with some code that would accomplish something like this???

Replies

Avatar

Avatar
Boost 500
Level 10
pguerett
Level 10

Likes

611 likes

Total Posts

7,689 posts

Correct Reply

692 solutions
Top badges earned
Boost 500
Boost 50
Boost 5
Boost 3
Boost 250
View profile

Avatar
Boost 500
Level 10
pguerett
Level 10

Likes

611 likes

Total Posts

7,689 posts

Correct Reply

692 solutions
Top badges earned
Boost 500
Boost 50
Boost 5
Boost 3
Boost 250
View profile
pguerett
Level 10

24-11-2008

Assuming the dropdownlist is called DDL your code woudl look something like this:



On the exit event of the DDL field and the code is set to javascript:



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

TextField1.presence = "visible";

TextField3.presence = "visisble";

} else {

TextField2.presence = "invisible";

TextField4.presence = "invisible";

TextField5.presence = "invisible";

Textfield6.presence = "invisible";

}



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

TextField4.presence = "visible";

TextField5.presence = "visisble";

Textfield6.presence = "visible";



} else {

TextField1.presence = "invisible";

TextField2.presence = "invisible";

TextField3.presence = "invisible";

}



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

TextField2.rawValue = "visible";

} else {

....add code to make all other fields invisible

}