I'm trying to make a button lock field, speel check, then prompt to save file. Everything work except the SaveAs part. I tried using a break statement in the for loop and that fixed the SaveAs, but it only hid the first set of buttons. What am i doing wrong??
var response1 = xfa.host.messageBox("No furthur can be made after finalizing this document. Are you sure you want to finalize? Click OK to continue.","WARNING: Finalizing Document!",2,1); //xfa.host.messageBox( "response is " + response1); //get response code if (response1 == 1) { app.execMenuItem("Spelling:Check Spelling"); var lock = xfa.resolveNode("form1.Page1._lockForm"); // Get the field containers from each page. 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 = "protected"; } } form1.Page1.Subform1._lockForm.rawValue = 1; form1.Page1.Subform1.lockbtn.presence = "hidden"; form1.Page1.Subform1.office.presence = "hidden"; form1.Page1.P4.Add.presence = "hidden"; form1.Page1.P4.Remove.presence = "hidden"; form1.Page1.P7.Add.presence = "hidden"; form1.Page1.P7.Remove.presence = "hidden"; form1.Page1.P9.Add.presence = "hidden"; form1.Page1.P9.Remove.presence = "hidden"; form1.Page1.P2.Add.presence = "hidden"; form1.Page1.P2.Remove.presence = "hidden"; datefld.border.edge.color.value = "255,255,255"; sector.border.edge.color.value = "255,255,255"; mw.border.edge.color.value = "255,255,255"; for (var i = 0; i < 21; i++) { var sSOM1 = "form1.Page1.Subform2a.Subform2b[" + i + "]"; var oSubform1 = xfa.resolveNode(sSOM1); oSubform1.Add2.presence = "hidden"; oSubform1.Remove2.presence = "hidden"; break; } app.execMenuItem("SaveAs"); } else note.rawValue = "noup";