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

Readonly question

excelgeek
Registered: Nov 3 2007
Posts: 44
Answered

Hi
I have a script which locks the fields but it lists them individually. Is there a way like in acrobat that you can set the name to say T.Textfield1,T.Textfield2...etc and then call just the value of "T." so you don't have to name every field?

Textfield1.access = "readOnly"
Textfield2.access = "readOnly"
Textfield3.access = "readOnly"
this.Page8.ImageField2.access = "readOnly"
this.Page8.Name.access = "readOnly"
this.Page8.Title.access = "readOnly"
this.Page8.Textfield1.access = "readOnly"
this.Page8.Textfield2.access = "readOnly"

Thank you for your assistances.

My Product Information:
LiveCycle Designer, Windows
radzmar
Expert
Registered: Nov 3 2008
Posts: 1202
Yes, you can use a for loop for this.
There is an example in the Designer Scripting Reference Manual.

for (var nPageCount = 0; nPageCount < xfa.host.numPages; nPageCount++) {var oFields = xfa.layout.pageContent(nPageCount, "field");var nNodesLength = oFields.length;for (var nNodeCount = 0; nNodeCount < nNodesLength; nNodeCount++) {if (oFields.item(nNodeCount).name.substr(0,2) == "Te") {//Here come the code to executeoFields.access = "readOnly";}}}

radzmar
LoveCycle Blog
Documents you need:
LiveCycle Designer ES2 Docs