Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

Dynamic content selected by drop-down

Avatar

Former Community Member
Is there any way to make a change the visibility of a Subform via a dropdown list? It seems so easy with radio buttons but when I try to apply some of the scripts (with modifcation) on drop-down's, it just doesn't work. It doesn't seem to cature the value of the dropdown when I change it, either in xfa.event.NewText or DropDownSel.rawValue. I have tried with both if statements and switch.



switch (xfa.event.newText) {

case "108":

Subform1.presence = "visible"

break;

default

Subform1.presence = "hidden"

break;

}



and



if (xfa.event.newText == "108") {

Subform1.presence = "visible";

}else{

Subform1.presence = "hidden";

}



I have tried to use it in Click, Exit, Change, almost all of the options available, but It doesn't want to change. Is it just something wrong with my logic or am I just way over my head in thinking that it should work the same way layers in html javascript do?
6 Replies

Avatar

Former Community Member
I put the following code in the change event of a dropdown and it worked fine.



if (xfa.event.newText == "show") {

form1.mainform.thesubform.presence = "visible";

}else{

form1.mainform.thesubform.presence = "hidden";

}



Check the your referencing of the subform.

Avatar

Former Community Member
Thanks, that worked like a charm. Had some problems at the beginning getting it to work, but I found out that I was saving the document as static pdf.

Avatar

Former Community Member
I used the same code for my drop down..it gives me run time error and the application terminates. Please help

Avatar

Former Community Member
This code is not working for me in a drop down list/....it works fine for a check box...what am I doing wrong??

Avatar

Former Community Member
Have you tried re-saving the document as a dynamic pdf? It didn't work for me either, until I tried the save as.. option and selected dynamic pdf