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

Hide / Show subform based on Drop-down List rawValue?

lukewallace4343
Level 1
Level 1

I have a Drop-down List which has two List Items; List Item 1 | List Item 2

I have a subform beneath it which I want to only be visible when List Item 1 is chosen.

The script I'm using to accomplish this is pasted below which is located in the validate event of the subform:

if (this.DropDownList.rawValue == "List Item 1")

{

    this.presence = "visible";

}

else

{

    this.presence = "hidden";

}

The problem is that putting this in the validate event in the script editor causes validation error popups. If I put the javascript code into the layout:ready event, then the hidden subform will not be flowable (it will behave as if positioned), if I put it in the calculate event then my subform becomes read-only and so on and so forth.

.

How can I make it so that every time the Drop-down List rawValue is changed, the subform will be updated during run time? There must be some javascript that forces all subforms throughout the pdf to run any javascript that is in them for a certain event type (such as layout:ready), or all event types (I dont care). If that is true, then what event should I be using as a best practice? (I have no clue here, total novice).

0 Replies
whyisthisme
Level 7
Level 7

try putting the code in the exit event of the drop-down list, and the code should be something like:

if (this.rawValue == 1) {

subform1.presence = "visible";

}

else {

subform1.presence = "hidden";

}

lukewallace4343
Level 1
Level 1

that would require the coder to keep track of which subforms belong to which category all in the javascript of the drop down list which is too complicated.

kjaeggin
Employee
Employee

Validation events are not meant for layout changes. You should put the script in a different event, since it is expected to only handled a return value of true or false.

You may find this useful as it discusses adding or removing subforms in a flowable layout:

http://help.adobe.com/en_US/livecycle/11.0/DesignerHelp/WS92d06802c76abadb11a7f71129b8b00825-7fb3.2....

setting a subform's presence property to "hidden" will have a similar effect to using the instanceManager. it will depend which makes more sense to use in your case.

Using the Action builder, you can graphically build the logic you want without scripting it. It may also help you.

You can execute another object's events, by calling methods such as execInitialize(), or execCalcutate(), for example. But I caution that calculate events are only intended for calculations, and validations are only for validations, etc. Whythisisme posted a valid sample. Typically, you could make a change to layout on an exit event. A dropdown's value from the selection is not commited until the object has lost focus, typically by tabbing out, or clicking away from it, so the exit event would make sense in that sample case, if it is the subform which flows underneath it that is being affected.

KJ