Skip to main content
Known Participant
October 3, 2018
Answered

Is it possible to ONLY make one page read-only in a document?

  • October 3, 2018
  • 1 reply
  • 987 views

Hi

I have a button on my test document that makes all fields read only when the salesrep has finished editing.

for (var i = 0; i < this.numFields; i++) {

    var fname = this.getNthFieldName(i);

    this.getField(fname).readonly = true; // makes all fields readonly

}

I​t works perfectly, but I've realised that when I add the rest of the pages back into the document, there are fillable fields on pages 2 and 3 that a customer might need to complete once they've received the document.

So, is it possible to make only page 1 read only and leave pages 2 and 3 editable?

Thank you

This topic has been closed for replies.
Correct answer try67

Sure. You can use this code to do it:

for (var i = 0; i < this.numFields; i++) {

    var fname = this.getNthFieldName(i);

    var f = this.getField(fname);

    if (f.page==0) f.readonly = true; // makes only fields on page 1 readonly

}

1 reply

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
October 3, 2018

Sure. You can use this code to do it:

for (var i = 0; i < this.numFields; i++) {

    var fname = this.getNthFieldName(i);

    var f = this.getField(fname);

    if (f.page==0) f.readonly = true; // makes only fields on page 1 readonly

}

jlehaneAuthor
Known Participant
October 3, 2018

I thought that had worked, but it seems to have left all the radio buttons on page 1 editible?

try67
Community Expert
Community Expert
October 3, 2018

Yeah, fields with more than one "widget" are a bit more tricky... Try this:

if ((typeof f.page=="number" && f.page==0) || (typeof f.page=="object" && f.page.indexOf(0)!=-1)) f.readonly = true;