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

Selective Reset of a form

comp_dad
Registered: Oct 18 2007
Posts: 18

I am working on a Supplier feedback form.

Stared in Adobe and then finished in LC Designer.

Problem. If they wish to provide more than one response, I do not want to clear the small group of demographic entrys.

Tried to use Adobe and the look at using the reset action command , thinking I could select the fields I wanted or did not want to clear. Opps, can not edit in Adobe Pro and more, only LC Designer.

Started reading... Again.

Example 1.

Select fields to be reset and reset them.
var fields = new Array();
fields[0] = "P1.OrderForm.Description";
fields[1] = "P1.OrderForm.Qty";
this.resetForm(fields);

The same fields can be reset using only one line of code:
this.resetForm(["P1.OrderForm.Description","P1.OrderForm.Qty"]);

Example 2.

This example shows how to reset a whole subtree. For example, if you pass “name” as part of the fields array, all name fields, such as name.first and name.last, are reset.
this.resetForm(["name"]);

However, not being aware of all this before hand... means I do not have sub trees ? I could group in a sub form, but I want this group to remain, the rest of the form to be reset.

Can some one provide some guidance to me as to how I can reset a form, but EXCLUDE 4 Fields.

Thanks

My Product Information:
LiveCycle Designer, Windows
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
First, please post short and concise questions. The very last line would work just fine.

Next, since you are using a LiveCycle form you should use the reset function for LiveCycle JavaScript.

xfa.host.resetData();

I don't imagine that "this.resetForm()" would do anything if used from a button in a LC form.

Unfortunately, there isn't a function for resetting everything except a few fields. If there are too many fields to write it all in a single reset, and you can't group the non-reset fields into a subform, you'll have to write a function to do this.

Actually, it isnt' too bad. The XFA layout DOM has a function that returns a collection of all the fields on a page.

xfa.host.pageContent(pgNum,"field");

Use this function to walk through all fields on all pages to get the full SOM paths of all the fields, excluding of course the ones you don't want reset. Then just pass the final list into the "xfa.host.resetData()" function.

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