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

reset a row

nawaha
Registered: Jul 30 2011
Posts: 11

goodmorning
i have a form with 5 rows and each row has 20 fields i wrote a javascript to reset and to give an alert "are you shure?" do you know a way to select all the rows without typing each one?
thanks

My Product Information:
Acrobat Pro 10.0, Macintosh
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Form fields are grouped by how they are named.

For example, prefix all the field names in the first row with "Row1", so the names look like this.

Row1.Text1, Row1.Text2, Row1.DropDown3, Row1.Check4, etc.

Now all the fields in Row1 are grouped as "Row1" and are reset by referring to the group name.

this.resetForm(["Row1"]);

The grouping can be extended to multiple levels. So the entire table is grouped by prefixing all the field in the table with the same name. For Examples


Table1.Row1.Text1, Table1.Row1.Text2, Table1.Row1.DropDown3, Table1.Row1.Check4, etc.
Table1.Row2.Text1, Table1.Row2.Text2, Table1.Row2.DropDown3, Table1.Row2.Check4, etc.

// Reset Row 2
this.resetForm(["Table1.Row1"]);

// Reset the entire table
this.resetForm(["Table1"]);




Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4307
If you used hierarchical field names for the items in the columns then you only need use the high level column names in the 'resetForm()' array parameter list.

If you had columns with 'ItemID', 'Description', 'Price', 'Quantity', and 'Cost' and used the place multiple fields for creating the rows, then the first row would consist of 'ItemID.0', 'Description.0', 'Price.0', 'Quantity.0', and 'Cost.0'. Each row's field names would be incremented by 1. You could then clear only the array of fields with

this.resetForm(['ItemID', 'Description', 'Price', 'Quantity', 'Cost']);

George Kaiser

nawaha
Registered: Jul 30 2011
Posts: 11
thanx for answer i tried to put the code you teached me but it gives me always errors
what i have in my form is a few entries: name, company, country e-mail, then i have 5 columns to fill: our code, original code, description, quantity and price.
on top of each column i have the name of column.
below you can see what i've done until now......
do you think is useful if i send to you the original form?


if( app.alert({
cMsg: "This action will reset the form! " + "\n" + "\n" + "Do you want to continue?",
cTitle: "Reset Form Warning",
nIcon: 2,
nType: 2
}) == 4)
{
var fields = new Array();
fields[0] = "mister";
fields[1] = "company";
fields[2] = "country";
fields[3] = "mail";
fields[4] = "Qnty";
fields[5] = "date";
fields[6] = "drop";
fields[7] = "Description";
this.resetForm(fields);
}



gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4307
Exactly, including all text and numbers, what is the error message you are getting?

The error message will contain reference to a line number, action, field etc but you may think this is meaningless text. It is not!

Make sure you capitalization and spelling for all field names is correct.

George Kaiser