I'm a total n00b with LCD, so please bear with me. I've already spent many days on Google, and though I've learned much about Javascript I haven't found anything similar to what I need to do. I hope someone here can help!
What I'm trying to do:
-create a 'Finalize' button which will perform three functions; open the 'save as' dialogue to save the filled out form, set all fields to read only, and make the button disappear from the newly saved form. There is a print button on the form which must remain active after saving, and I want all of this to work from Reader once completed.
What I've got so far:
-script to open 'save as dialogue';
app.execMenuItem("SaveAs");
-script to set all fields read-only;
for (var nPageCount = 0; nPageCount < xfa.host.numPages; nPageCount++) {
var oFields = xfa.layout.pageContent(nPageCount, "field");
var nNodesLength = oFields.length;
// Set the field property.
for (var nNodeCount = 0; nNodeCount < nNodesLength; nNodeCount++) {
oFields.item(nNodeCount).access = "readOnly";
}
}
Basically I need to know what I need to add to the script to keep my print button, known as form1.Page1.PrintButton, active after clicking, and to make the 'Finalize' button invisible. I tried adding the line:
form1.Page1.FinalizeForm.style.visibility="hidden";
to the script but it did not seem to work.
What am I doing wrong?
The "presence" property controls the visibility of form elements. This tutorial covers a bunch of the XFA scripting concepts, including hiding and showing fields.
http://www.acrobatusers.com/events/online/245
To exclude certain fields from being set to read only, qualify the line of code that sets the access property with an "if" statement.
If you've got more than one then use an object
Or name them a certain way and use a regular expression
To do proper LiveCycle programming you'll need both the Acrobat JavaScript Reference and the Adobe XML Form Object Reference, these and lots of other docs can be found at www.adobe.com/devnet. You should also get a book that covers Core JavaScript.
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.acrobatusers.com/tutorials/2006/javascript_console][b]The Console Window[/b][/url]
Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script