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

Adding Row/Removing Row/Moving Row Script

Biffnet7
Registered: Dec 9 2009
Posts: 36

Hello
 
I copied a script from a PDF that can add, remove, and move rows around in a table. It works great in this one table. The problem is my form needs more than one table that has this functionality and I can’t seem to make the new tables I created work.
 
What do I need to edit in the JavaScript to make multiple tables work? I have one table named schedule, another named materials. They all need to add rows etc…
 
Any help would be appreciated.
 
Thanks
 
Allen

Allen

My Product Information:
LiveCycle Designer, Windows
SLDC
Registered: Oct 25 2010
Posts: 70
Without seeing the script, all I can suggest is that you make certain all the object references are changed to match the new table(s). For instance, make sure every instance of "schedule" is changed to "materials", etc.
Biffnet7
Registered: Dec 9 2009
Posts: 36
Thanks for the reply

I use 3 scripts below

Add row button:
Table._Row.addInstance(1);
xfa.form.recalculate(1);

Remove Row button:
_Row.removeInstance(this.parent.index);
xfa.form.recalculate(1);

Move Row:
if(Row.index != 0)
{
var nIndexFrom = Row.index;
var nIndexTo = Row.index - 1;
Row.instanceManager.moveInstance(nIndexFrom, nIndexTo);
xfa.form.recalculate(1);
}

I have about 4 tables that I need to haev this finstionality in. I originally just made a copy of the same Table that currently works and moved it to different pasrts of the form but there are erros where it doesn't save rows when they are added after you reopen the form.

I am thinking that I need to be specific in naming each table correctly.

Allen

Allen

Biffnet7
Registered: Dec 9 2009
Posts: 36
Ahh I figured it out. Sorry for all the posts.

Allen

Allen

SLDC
Registered: Oct 25 2010
Posts: 70
I'm glad it worked out. Consider posting your solution for when others find this thread via search, and don't forget to click "Answer Accepted". :)