These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Button to duplicate fields not content

pauline12
Registered: Sep 10 2009
Posts: 7

I am trying to create a button that will duplicate fields that I have displayed as a line item.

For example

Vendor Name ! Contractor Name ! Contractor Role ! Start Date

I would like to have a button under this list which reads "Add another contracotr", which would create a second line.

Vendor Name ! Contractor Name ! Contractor Role ! Start Date
Vendor Name1 ! Contractor Name1 ! Contractor Role1 ! Start Date1

Any help would be greatly appreciated.

Thanks.
P.

My Product Information:
LiveCycle Designer, Windows
radzmar
Expert
Registered: Nov 3 2008
Posts: 1202
You will need subforms for this task.

Create your fields "VendorName", "ContractorName"... and a button "AddFields" and surround them all with a subform and rename it to "Contractor" for example.
Then put this subform into another subform which is set to floating.
Finally add this JavaScript to the button.
_Contractor.addInstance(1);
With every click there will be added new instance of the subform "Contractor" to the form.

radzmar
LoveCycle Blog
Documents you need:
LiveCycle Designer ES2 Docs

pauline12
Registered: Sep 10 2009
Posts: 7
Thank you for taking the time to post this. I have a couple questions.

"Then put this subform into another subform which is set to floating."

Does it matter what I name the subform that I put the Contractor subform in? And how do I set it to floating.

Thanks,
Pauline
pauline12
Registered: Sep 10 2009
Posts: 7
Thanks radzmar but I can't seem to get this to work.

Does anyone have any other ideas?

Thanks,
Pauline
radzmar
Expert
Registered: Nov 3 2008
Posts: 1202
Hi,

I made a little sample for you.
There you can see, how it works.

https://share.acrobat.com/adc/document.do?docid=f36c99d4-1c80-4186-9fdb-34b235129d8e

radzmar
LoveCycle Blog
Documents you need:
LiveCycle Designer ES2 Docs

pauline12
Registered: Sep 10 2009
Posts: 7
Thank you for taking the time to create a sample. The link doesn't seem to work. I get a "The page cannot be displayed" error.

Thanks,
Pauline
radzmar
Expert
Registered: Nov 3 2008
Posts: 1202
The link is working fine.

You have to download the file and open it in your LiveCycle Designer ;-)

radzmar
LoveCycle Blog
Documents you need:
LiveCycle Designer ES2 Docs