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.

Reset subforms on pdf reload


Level 2

I have a problem when loading a pdf which has partially filled in form field values.

The form has repeating sections and multiple related sections.
There are several drop down lists and radio button lists which control the display of other sections.

This is my scenario:

Open a new form, this has R1 with subform X1 as default
Enter data in fields
Make radio button selection (R1) which removes one subform(X1) and adds another (A1).
The new subform(A1) has a drop down list(D1) which when changed, adds another subform(B1) and removes others(Y1).
Add a copy of the first form which creates another radio button list (R2) and default subform X2.
Make radio button selection (R2) which removes one subform(X2) and adds another (A2).
The new subform(A2) has a drop down list(D2) which when changed, adds another subform(B2) and removes others(Y2).
Save the form with the selections and close the form.
Reload the form.

The previous selections made are displayed but the removed subforms are not removed. That is, X1 and A1 are shown, B1 and Y1, X2 and A2, etc.

It appears that the change event of the radio buttons and ddlists are not triggered on document load - the reference documentation for Designer confirms this.

So my problem is how to redo all the show/hides actions (which occurred in interactive mode) on document loading. (The document must work correctly both when a brand new form empty form is loaded and also when a partially prepopulated form is loaded. As well as the interactive actions working as expected.)

Solutions that I have looked at are fiddling with the settings of forms, and forcing the running of the change events.

Which would be the right approach?

To force a change event I need to find another event which occurs only on document load and force the change event from there.

There are two decisions to be made - which event and which object to select for the event?

There are multiple possible events to hook into but I am not sure which is the best one.
The Process events that I have looked at are


layout:ready does not seem the right one as I need to change the layout and there are specific warnings against that, so I reject this one.
initialize also does not seem the right one as I need access to data and I believe that necessary info may not be available, so I reject this one.
That leaves docReady and form:ready. In my tests both seem to work so which is the right/better one?

Then the question of which object to use must be answered.

I tried using the form:ready event on the radio button(R1) to trigger the change event of R1. This certainly ran the change event correctly when the form was loaded with data.
Then I needed to put a form:ready event on the drop down list (D1) to run the change event so that the B1 forms were also updated.
This resulted in the sequence of events running thus:

R1 change event
D2 change event
D1 change event
R2 change event

So the sequence was out of kilter. Since the R2 change event had not run first before the D2 change event, various form settings were not in place so the display still was not correct.

So, not right yet.

Can anyone assist me on the right track or show me where to read some advice on this requirement? Am I on the right track at all?

All suggestions appreciated.

3 Replies


Level 7

Your form should be 'remembering' the changes when you reload them - you do not have to fire the change events again. If you go to File/Form Properties under the Defaults tab there is a Scripting box. Under the question 'Preserve scripting changes to form when saved:' make sure the Automatically radio button is checked. This means that whatever you do to a form will be saved and when you reopen it will be the same.


Level 2

Yes that option is selected already.

But it does not seem to be having the desired effect.


Level 2

In the end I achieved what I wanted by using scripting in the form:ready event of specific objects.

The radio button list (R1) has a form:ready event in which I called the change event.

In turn the R1 change event calls the D1 change event.

When I tracked these events through the form loading process then I got the desired sequence R1, D1, R2, D2, etc etc.

Because the default value of R1 is to show the A1 subform, then when a brand new form is loaded, and the R1 change event is called from the form:ready event, then A1 form is initially displayed as required (even though the subform has the pagination property having initial count of 0).

The solution turned out to be rather more complicated than I would have liked but at least it works.