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.

Renaming forms after dynamic creation

Avatar

Former Community Member

I have a form that spans two pages. The user has the ability to dynamically create x forms which are appended under eachother. The problem is dealing with the XML output generated by allowing this.

How can I rename a form based on the index it was created? For example I want to have my xml output something like:

<form1>

     <some data> data </some data>

<form2>

     ....

<form3>

     ...

<Rest of the data>

Here's what I've got so far:

totalPatients.value += 1;

var form = master_subform.instanceManager.addInstance(1);

form1.name += totalPatients.value;

where totalPatients is a form level variable.

Right now all the forms are showing up with the same name like this:

<form>

<form>

<form>

...etc

4 Replies

Avatar

Level 10

Hi,

the fact is "you can't".

Repeatable objects always have the same name, otherwise you couldn't add or remove instances of them.

Avatar

Level 10

Hi,

the fact is "you can't".

Repeatable objects always have the same name, otherwise you couldn't add or remove instances of them.

Avatar

Former Community Member

Why would having a different name stop us from deleting it?

Wouldn't this do the trick?

this.parent.parent.instanceManager.removeInstance(this.parent.index);

Where 'this' is a button in a subform which deletes it.

Either way, maybe it would be easier to handle the XML as is but give it a unique name when I put it into an array.

Avatar

Level 2

You might be able to XSL-transform the XML output. Sorry - I have no example for you.

Once you have that running, you can insert the XSLT into the PDF output processing (in Data View/data connection/connection properties/2nd mask/Transform Outgoing Data). If I remember right, the file extension has to be "xsl", not "xslt"; and I use a short path with no blanks in it.

This way I usually tweak the Adobe XML output to the XML structure I need to send (and import somewhere else).