Hi,
I am creating a dynamic form. I have a dynamic table with "ADD", and "REMOVE" buttons. The ADD button is at the bottom of the table and I have only 1 button. The REMOVE button is located on each of every row. When a user clicks ADD, a new row is added to the bottom of the table. When a user clicks REMOVE, that particular row is deleted.
On each row, I would like to have a column that shows the row number. (E.g. the column name would be something like "#", "Item"....)
The question is how can I make this row number dynamic? My idea is to get the row number of that row in a table, but I don't know what function to use to get a row number.
Thanks,
Boon
this.rawValue = this.parent.index + 1;
if "this" is a pointer to the text box, then "parent" is a pointer to the subform that contains the text box and "index" is the instance number for that subform. The instance number is zero based, so add one to make the row number.
This code needs to be placed on an event that is called whenever the parent subform index changes. Then is an index change event, but it is unreliable in some situations. A better choice is the "layoutReady" event.
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