Expand my Community achievements bar.

Numbering Expandable tables

Avatar

Level 1

Hi there,

I am just wondering how you can add numbering to a table where you can expand and add more lines to? (My table only has one line to start and i want this numbered 1, then if anyone clicks the add another line button, I want that the next line to be numbered 2 then 3... etc.. How can I do that?

Jaclyn

7 Replies

Avatar

Level 10

On the Calculate event of the field you can put the following:

FormCalc:

$ = this.parent.index +1

or

JavaScript:

this.rawValue = this.parent.index +1;

Avatar

Level 1

I just noticed the numbering works great adding new rows to the table, but when i go to delete a row (if i added to many) then the numbering gets all messed up. (The number one disappears, so the first row becomes number 2 and the second row is also number 2. If i delete 2 rows then the first row is number 3, the second is number 2, then third is number 3) So everything works except it deletes the beginning numbers instead of the end ones.. This happens if I use the formcalc or the java script equations. Any suggestions?

Avatar

Level 10

Oh, I think depending on version of Acrobat you may need to add xfa.form.recalculate(1); to the buttons controlling the add/remove.

Avatar

Level 1

I think i already have that in my button. (I didn't program the add/remove buttons but heres what I have in the xml):

//+ Type: Action

//+ Result1: RemoveInstance("$Node2","currentindex","")

//+ Node2: form1[0].SubformProp[0].PropTable2[0].OPSection2[0]

//+ Node1: form1[0].LB_OP_ButtonsSubform2[0].Table2[0].Row1[0].OP2[0]

//+ Condition1: Button("$Node1","click")

//+ ActionName: OP2.click

this.resolveNode('SubformProp.PropTable2._OPSection2').removeInstance(this.parent.index);

if (xfa.host.version < 8) {

xfa.form.recalculate(1);

}

//-

Avatar

Level 10

Not sure what's going on, that should do the trick.

Can you post the form?

Avatar

Level 1

I tried it on another form and it worked good. I will try just redoing the table, maybe that will help.