Avatar

Level 10

You use fieldName.access = "readOnly"; I'm currently using a script that locks down the whole form:

// Get the field containers from each page.
for (var i = 0; i < xfa.host.numPages; i++) {
var oFields = xfa.layout.pageContent(i, "field");
var nodesLength = oFields.length;
// Set the access type.
for (var j = 0; j < nodesLength; j++) {
var oItem = oFields.item(j);
if (oItem != this) {
oItem.access = "readOnly";

}

}

}

(Double check the number of closing braces if you use the above script, I've copied it out of another chunk of code (I'm using WindJack's AcroDialogs to do popups))

You'll have to play around with just doing subforms - I'm not sure if the readOnly will propogate to child items. You may have to use a variation of the script to loop through a subform making things read only. Hopefully Paul or someone here can help you with that, I'm not sure how to change it to do a subform only.