I am creating a PDF form in Adobe Acrobat 9 that has a rows of fields that each represent a line in a database. The user will fill out a line for each individual specimen. To make the form I create the first row then use the "place multiple fields" function to repeat this for the number of rows I need. This way the fields have a predictable naming scheme and the data can be easily extracted when the data entry is complete. I know that PDF forms do not really work on the concept of rows. The data will be extracted into rows based on the field naming convention. The first field in each row is a row number. What I am trying to do is to use Javascript to automatically fill the line number fields. How I envision this working is that the user will type a number into a field somewhere on the form to indicate the first row number they want. Once they move away from that field I want the row number fields to be populated with row numbers starting with the number the user typed in and incrementing by one for each row. I have tried a few things but the latest is:
As an on blur action in the properties of the "begin row number" field:
lnenbr = 0;
lnenbr = getField("First Line Number").value;
As a custom calculation script for each of the "row number fields" ( Named LineNum_1.0 with the portion after the "." incrementing by one for each row):
var f = this.getField(event.target.name) //creates a variable for the row number form field
f.value = lnenbr //sets the form field to equal the counter
lnenbr ++ //increments the the counter by one
This works, but not correctly. If I type a number in the "begin row number" the mouse click off that field nothing changes in the row number fields. If I then type a new number in the "Begin row number" field, then mouse click off of that field, the row number fields are numbered in sequence but beginning with the previous value I typed in "begin row number". Also the first row number field does not change. Any ideas on how I could get the behavior I want either through a modification of my method or something completely different? I am a Javascript novice.