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

Adobe Summit 2023 [19th to 23rd March, Las Vegas and Virtual] | Complete AEM Session & Lab list

Dynamically Generate Fields


Not applicable
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???
1 Reply


Level 10
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