Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Nested dynamic subforms

Avatar

Level 2

Is it possible to have a nested dynamic subform?

What I am doing is creating a from that will have a dynamic table that will  be duplicated by the user as needed. However within each dynamic table I am  hoping to have dynamic sections as well. Is this possible or do I need to  re-plan my form?

1 Accepted Solution

Avatar

Correct answer by
Level 10

In your script you have dynamic._"maintable".addInstance(1);

You just need to remove the quotes from around maintable.

View solution in original post

9 Replies

Avatar

Former Community Member

It is possible but the coding can get very tedious. Make sure you name every subform and create a good structure (flowed from the root, then positioned for each subform, then flowed for the repeating sections).

Paul

Avatar

Level 2

Do you have an example of the coding for this? Or is it just using the following code like you normally would:

// Invoke the Instance Manager to add one instance of the "Subform Name" subform.

"parent subform name"._"Subform Name".addInstance(1);

//Invoke the recalculate method to include the field values from the added row in calculations.
xfa.form.recalculate(1);

Avatar

Former Community Member

Thats it ...but the parent subform can have an occurance number if this subform is embedded in a recurring subform ...so it is like this:

"parent subform name"[instance number]._"Subform Name".addInstance(1);

Paul

Avatar

Level 2

Thanks for that!

One quick question. Can I add a dynamic section with a button that resides in the section I am trying to add dynamically? See attached form.

In the bottom left of the table I have a add button for the table but it' isn't working and I can't figure out why. any help would be appreciated.

Avatar

Level 2

Just bumping this thread to seeif my question gets answered.

Avatar

Former Community Member

Your form is queued and cannot be retrieved ..can you try attaching it again?

Paul

Avatar

Level 2

Bumping still need an answer if I can.

Avatar

Correct answer by
Level 10

In your script you have dynamic._"maintable".addInstance(1);

You just need to remove the quotes from around maintable.