Hello,
I need help figuring out the following problem.
I designed a XML-form with 15 pages with several buttons on the master page.
The buttons are "Reset form", "Mail form", "Close form", "Print form" and "Edit form" (a hidden button).
To avoid that receivers of the mailed form are able to change the content, the Mail button uses a JS to protect all fields with a password.
What I want now is to hide all the Reset buttons when the user clicks the Mail button and showing up the Edit buttons for them, that asking for the password to return the protection.
Should not be a problem (I thought), but the showing and hiding of the buttons only works for the first instance of my master page (MP[0]).
I need a way to show/hide all buttons on the master page (MP[0] to MP[14]).
I found a code snippet in the web and used it for my form.
xfa.resolveNode("form1.#pageSet.MP[" + i "]").ResetForm.presence = "hidden";
But the script editor does not like it :-(
xfa.resolveNode("form1.#pageSet.MP[" + i + "]").ResetForm.presence = "hidden";
This one causes no error in the script editor but in the JS debugger.
i is not defined.
OK, I really had always problems understanding working of the i-variable :-/ and watching into the JS api manual or the PDF forms Bible does not help me at the moment!
So, I really hope, someone of you give me useful hints!
// Hide Reset and show Edit buttons and activate field protection
//Hide all Reset-Buttons!
for (var i = 0; i < xfa.host.numPages; i++)
{
var sSOM1 = "Form1.MasterPages.MP[" + i + "]";
var oSubform1 = xfa.resolveNode(sSOM1);
oSubform1.Reset.presence = "hidden";
oSubform1.EditDoc.presence = "visible";
oSubform1.EditDoc.relevant = "-print";
//Activate protection!
var oFields = xfa.layout.pageContent(i, "field");
var nNodesLength = oFields.length;
for (var nNodeCount = 0; nNodeCount < nNodesLength; nNodeCount++)
{
oFields.item(nNodeCount).access = "protected";
}
}
Works really nice.
radzmar
• LoveCycle Blog
Documents you need:
• LiveCycle Designer ES2 Docs