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

Add a new instance of my row in a table

affinit
Registered: Apr 7 2009
Posts: 18
Answered

Hi Everyone,

i need help trying to add a new instance of a row in my table.

i want to be able to click a button and it makes an exact copy of my current row into a new row underneath it, with all my formulas etc in it as well.

i've looked at the add rows example and have tried to implement this without success.

can anyone help me ?

this is what my form looks like so far.

http://www.bses.org.au/downloads/Steven_IT/Travel%20Form_AutoAdd_v0_1.pdf

is it because the other tables underneath won't move and that is why a new row won't insert ?

any assistance would be great

Kind Regards

Steven

My Product Information:
LiveCycle Designer, Windows
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
I think your problem has to do with not understanding the structure and operation of LiveCycle forms. Have you seen this tutorial?

https://admin.adobe.acrobat.com/_a200985228/p87746471/

Also I would suggest searching this site for anything having to do with LiveCyle and watching or reading those videos or articles.

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

Then most important JavaScript Development tool in Acrobat
[url=http://www.pdfscripting.com/public/34.cfm#JSIntro][b]The Console Window (Video tutorial)[/b][/url]
[url=http://www.acrobatusers.com/tutorials/2006/javascript_console][b]The Console Window(article)[/b][/url]

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

hcorbin
Registered: Aug 11 2009
Posts: 57
Hi Steven,

Here are few things to look into.

1. The form is saved as a static PDF. It needs to be saved as an Adobe Dynamic XML Form. This way the layout will be updated when rows are added.

2. The Table2.Row1 is not allowed to repeat. In Designer, select Row1, go to the Object palette, Binding tab, and check Repeat Row for Each Data Item. One way to catch this issue is to open the JavaScript Debugger when you preview the form. When I clicked the Add button, there was a warning saying ‘The element [max] has violated its allowable number of occurrences.’

3. Page1 is a positioned subform. It needs to be flowed. This way objects placed under the table will move to make space for the newly added row. In Designer, select the Page1 subform, go to the Object palette, Subform tab, and set the Content to Flowed. But before you proceed, know that the children of Page1 will be repositioned and flow on the page based on the order they are listed in the Hierarchy View i.e. Logo will be placed first followed by RequestforTravelApproval, Table5, Table1[0], so on so forth. To retain the current positioning of the form objects, you’ll need to add structure to your. Have a look at the Help topic ‘Organizing the form’ under ‘Quick Start Tutorials’ -> ‘Creating a purchase order form that has flowable layout’. You can also open the Dynamic Interactive Purchase Order form found at
[installDir]\EN\Samples\Forms\Purchase Order\Dynamic Interactive\Forms. It will give you an example of the type of structure you need to build.

Hope this helps,
Hélène
xrum
Registered: Feb 25 2009
Posts: 124
you can't add rows with static pdfs. change it to dynamic
affinit
Registered: Apr 7 2009
Posts: 18
HI Guys,

thanks for the suggestions. i've done all the steps Helene and xrum have suggested and have gotten the rows to fire off. i will figure out how to re-do the layout.

I'm having anew problem now in that my accomodation table has a few formulas in there to calculate cost per night and total cost for accomodation.

However when i fire off the new row. the combo boxes are throwing an error as they keep changing the first row's data.

http://www.bses.org.au/downloads/Steven_IT/Travel%20Form_AutoAdd_v0_2.pdf

this is the updatedd version.

also how do i view the javscript debugger ? thanks for the advice on this helene. i just deleted the code for max rows and it works fine.
hcorbin
Registered: Aug 11 2009
Posts: 57
Hello,

Try modifying your scripts to use relative SOM expressions.

The scripts populating the hotel and cost are using absolute SOM expressions to access these drop-down lists however the SOMs don’t specify which instance of Row1 to look under which also means use the first instance.

Given each object inside Row1 knows about each other, all you have to do is specify their name in the script. For example

form1.Page1.Table2.Row1.region::change - (JavaScript, client)hotel.clearItems();hotel.rawValue = null;if(xfa.event.newText == "Ayr"){hotel.addItem("Country Ayr Motel");hotel.addItem("Parkside Motel");hotel.addItem("Tropical City Motor Inn");hotel.addItem("Other");}

There is Help topic describing how to reference objects.
Scripting > Scripting Using LiveCycle Designer ES > Referencing Objects in Calculations and ScriptsAs for the JavaScript debugger, have a look at the Help topic here
Scripting > Scripting Using LiveCycle Designer ES > Debugging Calculations and Scripts > To enable the JavaScript Debugger for LiveCycle Designer ESOne last thing, the instanceManager has a count property so you don’t have to manually count the number of rows.
Scripting > Scripting Using LiveCycle Designer ES > Examples of Common Scripting Tasks > Using the properties of the instance manager to control subformsCheers
Hélène
affinit
Registered: Apr 7 2009
Posts: 18
HI Helen,

sorry for the late reply.

I've changed it according to the example code you gave int he previous post and have gotten the fields to change accordingly.

My final problem now is that towards the bottom of the form i have a Total field that is suppose to tally each of the different sections.

however now it will only add in the first row of the accomodation table not the total of the subsequent new rows that have been added.

i know this is something to do with the absolute addressing. however if i change it to just accomTotal i get a referencing error when loading it preview.

do i need to create an invisble field to tally all the rows from my dynamic table ? then use that as the total to be added to my overall total field ? how do i add the total of the dynamic rows ?

here is the updated file.

http://www.bses.org.au/downloads/Steven_IT/Travel%20Form_AutoAdd_v0_3.pdf
affinit
Registered: Apr 7 2009
Posts: 18
Hi Helene,

i found the answer here

http://www.acrobatusers.com/forums/aucbb/viewtopic.php?id=20693

thanks for all the help. !!

Steven