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

Script to add rows back

TrudyF
Registered: Dec 8 2005
Posts: 17

I am new to Adobe LiveCycle design and not JavaScript savy. I have a form with bulleted rows that I use the coding:

_Row1.removeInstance(this.parent.index)

behind a button in each of 6 rows. I also need to be able to add all the rows back in. I have a button in the table header row for this, but am not sure of the coding to use. I have:

_Row1.addInstance(0);

now, which only brings Row 1 back in. How do I tell it to bring all Rows 1-6 back?

Thanks.

lkassuba
ExpertTeam
Registered: Jun 28 2007
Posts: 3636
I'm not sure how you want to add the rows back but there is an example of how to do this individually at:
http://www.adobe.com/devnet/livecycle/articles/AddingRemovingTableRows.pdf

Lori Kassuba is an AUC Expert and Community Manager for AcrobatUsers.com.

Formfingers
Registered: Feb 7 2007
Posts: 90
Ikassuba - Do you know of an example/instructions that allows rows to function independently? My users need the ability to add and delete individual rows, most often in-between rows already generated. Each sample I've found only allows you to remove the very last row created, not a specific one.
Any suggestions??
sconforms
Expert
Registered: Jul 10 2007
Posts: 92
Formfingers,

To remove a specific row from within a set, you typically include a button in a cell on each row with a caption like "X" (to signify "delete"). The button's JavaScript, assuming the row is named "Row1", is typically as follows:

_Row1.removeInstance(this.parent.index);
I think you've got that part covered. Now using addInstance will always append to the end. What you need to do is use either a combination of the addInstance and moveInstance methods or, if you're using Designer 8.0+, use the insertInstance method.

For more information, see the [url=http://forms.stefcameron.com/2006/11/11/instance-manager-object-reference/]Instance Manager Object Reference[/url] topic on my blog.

Stefan Cameron obtained his bachelor's degree with Honors in Computer Science at the University of Ottawa and is a Computer Scientist working on Adobe's LiveCycle server products, in particular on LiveCycle Designer ES for the past 5 years.

Formfingers
Registered: Feb 7 2007
Posts: 90
sconforms,

Thank you for your reply! I've checked out your topic/blog and am still stumped on how to script this and make it work. I have 8.0 and my table is set up with one row, set as the repeating row when "+" and "-" buttons are clicked.

What I've found more helpful, is setting this up using the "instance manager to control subforms" example Designer provides under their help menu. It shows four buttons: adding, deleting, moving up, and moving down rows. This is EXACTLY what I need and have replicated it for my form. Problem is, that the buttons keep refering back to this one repeating row that I have for my table. I'm guessing my index reference is off somehow....but not sure where. I have copied the provided script EXACTLY, changing out the "Subform" reference in it to my table and row names.

Does this make sense? Any suggestions on how I can get their sample script to work for my rows?
scottsheck
Registered: May 3 2007
Posts: 138
Take a look at the Purchase Order sample provided with LiveCycle. It contains a delete button next to each row to delete any specific row.