suda Suda is the Senior Java EE Developer at IDR Solutions, and specialises in XFA, Fonts, True-Type Fonts, application servers and conversions. He is a keen science-fiction fan in his spare time.

A 6 Step guide on ‘How to create expandable XFA form in Livecycle Designer’

1 min read

At IDR Solutions we spend alot of time working with XFA in our Java PDF Library. I have spent a lot of time working with XFA and thought it might be useful to take you through how you can go about creating a simple expandable XFA form using the livecycle designer xml code.

Step 01)

Create a subform called “group” and insert another subform called “student” into it.

so you will end up a XML code similar to it

<subform w=”576pt” name=”group” layout=”tb”>
<subform name=”student” w=”100mm” layout=”tb”/>
</subform>

(ignore other attributes except name at the moment)

Step 02)

Insert two fields to student subform and name as username , coursename.

<subform w=”576pt” name=”group” layout=”tb”>
<subform name=”student” layout=”lr-tb”>
<field name=”username” w=”62mm” h=”9mm”>
……..//other field specification goes here
</field>
<field name=”username” w=”62mm” h=”9mm”>
……..//other field specification goes here
</field>
<keep intact=”contentArea”/>
</subform>
</subform>

Step 03)

Add a button named “InsertStudent” just after subform named as “group”

……………
<subform w=”576pt” name=”group” layout=”tb”>
<field name=”InsertStudent” w=”28.575mm” h=”6mm”>
……….//other button related stuff goes here
</field>
<subform name=”student” layout=”lr-tb”>

Step 04)

Add a javascript click event to the button so clicking the button will add student instances ( make sure to prefix an underscore before student.addinstance(1); script)

<field …….>
<event activity=”click” name=”event__click”>
<script contentType=”application/x-javascript”>
_student.addInstance(1);
</script>
</event>

Step 05)

Change the occur tag attributes of student subform to accept multiple occur capabilities

<subform name=”student” layout=”lr-tb”>
<occur max=”-1″/> …..

Step 06)

Save as a PDF file and try clicking insertstudent labelled button, you will find the expansion of the student form

After these steps you will get a form like the one listed in the screen shot below.

xfaaddition
The final result after following the guide to create expandable XFA form in Livecycle Designer

Hopefully you have found this guide useful, let us know what XFA guides you would like to see in the future.

This post is part of our “XFA Articles Index” in these articles, we aim to help you understand XFA.

If you’re a first-time reader, or simply want to be notified when we post new articles and updates, you can keep up to date by social media (TwitterFacebook and Google+) or the Blog RSS.

suda Suda is the Senior Java EE Developer at IDR Solutions, and specialises in XFA, Fonts, True-Type Fonts, application servers and conversions. He is a keen science-fiction fan in his spare time.

Leave a Reply

Your email address will not be published. Required fields are marked *