Expand my Community achievements bar.

SOLVED

Add Instance

Avatar

Level 3

In the first image below the user can click on "AC" to add additional lines for comments. When they have completed that they will click on "Add Line" to add a new instance of that line. In the 2nd image the 2nd line is overwritting the additional comments add to the 1st line. How do I position line two and additional lines to occur at the bottom of the additional comments (1 comment or 5+)

Also I need two more buttons

     1. Will add line and copy the contents of the line above

`    2. Move line - Up and Down button that will allow the user to reorder the entries.

Thanks in advance for your help!

image1.jpgimage2.jpg

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi,

It looks like you have the page set to a Positioned layout Subform > Pagination palette.

You will need a Flowed layout, so that new instances appear below previous objects. Have a look at hte various tables here that show the build up from a static layout to a flowed/dynamic layout: http://assure.ly/gk8Q7a.

Hope that helps,

Niall

View solution in original post

10 Replies

Avatar

Correct answer by
Level 10

Hi,

It looks like you have the page set to a Positioned layout Subform > Pagination palette.

You will need a Flowed layout, so that new instances appear below previous objects. Have a look at hte various tables here that show the build up from a static layout to a flowed/dynamic layout: http://assure.ly/gk8Q7a.

Hope that helps,

Niall

Avatar

Level 3

That was pretty easy thanks!

Any resources that might help me with (i haven't checked out your link yet)

  • Moving instances up and down in the form
  • Adding a new instance and copy the info from the instance above

--c

Avatar

Level 3

Niall,

Downloaded the file and looks like it's got what I'm looking for...got some work to do!

Thanks - I'll probably be back

Avatar

Level 10

Hi,


The example has several tables, the last two have add, remove buttons, as well as move button and button to add rows directly underneath (add instance and move it in one click).


There is an example I did here for someone. https://acrobat.com/#d=HD6XJ1qofZDf713Yq1P43g. From memory the add instance script also copied the rawValue of the "Send to" object to the "Reviewer" object in the new instance. This should give you a direction.


When it comes to LiveCycle Designer there is no single source with all of the information. Some of the Adobe resources are extremely valuable, but do not make for light reading.

A good book to start out with is JP Terry's book on LC Designer, which is excellent - "Creating Dynamic Forms with Adobe LiveCycle Designer".

We have some solutions and blog posts on our website http://www.assuredynamics.com. We are trying to make some of examples more instructional. Also if you go to the blog on our site you will see some other blogs that we strongly recommend.
 
There is also a range of online resources. You may find these resources helpful:
 
http://www.adobe.com/go/learn_lc_scriptingBasics

http://www.adobe.com/go/learn_lc_scriptingReference

http://www.adobe.com/go/learn_lc_formCalc

http://www.adobe.com/devnet/livecycle/articles/Adobe_XML_Form_Object_Model_Reference.pdf

http://www.adobe.com/devnet/acrobat/pdfs/lc_migrating_acrobat_xmlform. pdf

And a very handy resource (and while it is for version 6 it is still very good because of the way it is laid out):
http://partners.adobe.com/public/developer/en/tips/CalcScripts.pdf

The help file also helps with syntax and LC Designer comes with templates/examples.
 
Lastly, check out the Developer's Network on
http://www.adobe.com/devnet/livecycle/

Also a book that doesn't deal with scripting at all but is very good on form layout is "Forms that Work" by Caroline Jarrett and Gerry Gaffney.
 
The Adobe "PDF Forms Bible" is okay, but mainly focuses on AcroForms.
 
Windjack Solutions have a subscription based service for solutions and scripts at
http://www.pdfscripting.com. It has a lot of AcroForm script that can be amended to suit LC Designer and a growing library of LC Designer solutions.


Hope that helps,


Niall

Avatar

Level 3

Niall,

I've taken a different track on this and created a table which seems to work better. I'm stuck on being able to add an instance to just two of the cells.

I've added the + - to add and remove an instance of just "Special Conditions" and "Code". I've tried to wrap both in a subform but can only seam to wrap individually. Through action builder I created and add instance routine but when activated it add the instance to the right instead of below. What am I doing wrong?

Is there anyway to attach my form for review?

thanks,

-pc

Noname.jpg

Avatar

Level 10

Hi,

I am fairly sure you will not be able to addInstance for two objects in a table. In addition you can't set an object to be repeating.

So, what I would recommend is to create a second row at design time and set this up with just the buttons and two objects, with a blank cell to the left (so that the alignment is correct). Give this new row a different name. Then in the Object > Binding palette, set it to Repeat, BUT untick the minimum count. This way when the form is rendered it will not appear in the table. On click the + button that references this two-object row, a new instance will appear.

As the main row is repeatable as well, you will need to group the main row and the conditions row in a section. The add main row button would then addInstance of the section.

There is an example here: http://assure.ly/fItII5. It is not 100% the same, but may help you with the structure.

You can't upload files to the forums. So if you upload to a file sharing site, like Acrobat.com and then share the published link here.

Niall

Avatar

Level 3

Niall,

You have really helped me get this form in shape and ready to release next week. I'm stuck on one last piece of functionality - that is when copying the line above (or any line) that it copies the "AC" (added conditions) that are attached to that line number. Any line can have from 0 to 0+ added condtions and those usually travel with the other information on that line that will be copied.

So.....If a line has 3 added conditions and you copy that line those will show on the new line with the exact same "Special Conditions" and "Code". It will be much easier for the user to delete the ones on the new line that don't apply than to recreate them.

Where are you located? I've been to Ireland a couple times....done both the Dublin and Shannon areas. I prefer the golf on the West Coasts and LOVE Lahinch and the town there. Smithwicks's and Guinness taste fine on both coasts!

Thanks for your help - PC

Password for the form is Oscar

http://share.planswift.com/download/?file=ML7SMG8G-BW28-P1E7-YWY7-LAOCV4ZT752

Noname.jpg

Avatar

Level 10

Hi,

Here is the form back to you:

https://acrobat.com/#d=SHlgrYXlbPRZfh3FtgtMiA.

You need a couple of loops to count the number of additional condition instances and then create a sufficient number of instances in the new row.

// count the number of additional condition instances/rows

var nRows = xfa.resolveNode("form1.Subform3.Subform2.Subform1[" + secondLastRow + "]").Cond._Conditions.count - 1; // minus 1 because the row already comes with a conditions instance


// add the correct number of additional condition instances to the new row

for (var j=0; j<nRows; j++)

{

     xfa.resolveNode("form1.Subform3.Subform2.Subform1[" + lastRow + "]").Cond._Conditions.addInstance(true);

}


// loop through additional condition instances

for (var k=0; k<=nRows; k++)

{

     xfa.resolveNode("form1.Subform3.Subform2.Subform1[" + lastRow + "].Cond.Conditions[" + k + "]").Condition.rawValue = xfa.resolveNode("form1.Subform3.Subform2.Subform1[" + secondLastRow + "].Cond.Conditions[" + k + "]").Condition.rawValue;

     xfa.resolveNode("form1.Subform3.Subform2.Subform1[" + lastRow + "].Cond.Conditions[" + k + "]").Code.rawValue = xfa.resolveNode("form1.Subform3.Subform2.Subform1[" + secondLastRow + "].Cond.Conditions[" + k + "]").Code.rawValue;

}

You will have to buy me a pint when you are over next.

Niall

Avatar

Level 1

Niall, I've created a form with add instance function. It adds a line below. Someone asked if the add instance could insert the row above rather than below. I think your example is what they are asking me to do. I clicked the link and it does not take me to the example. Is it possible for you to e-mail me the  example?