Link to home
Start Free TrialLog in
Avatar of Mike Rudolph
Mike RudolphFlag for United States of America

asked on

Make only One page Read Only

I have a PDF doc that has three pages. After the first pages is signed (signature field on first page) I would like to make all the fields on that first page. When I use the following code:
 for (var i = 0; i < this.numFields; i++) {
        var fname = this.getNthFieldName(i);
        this.getField(fname).readonly = true; // makes all fields readonly
    }

Open in new window


as you can imagine...all the fields are made read only but I 'only' want the fields on page one to be read only. I've searched the web but cannot find what I am looking for. Any help would be most appreciated. Otherwise I am going to have to make each field read-only one by one in javascript code. That's a pain!  :-)
ASKER CERTIFIED SOLUTION
Avatar of Julian Hansen
Julian Hansen
Flag of South Africa image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
 for (var i = 0; i < this.numFields; i++) {
        var fname = this.getNthFieldName(i);
        if( form.getFieldPositions(fname).get(0).page == 0 ) {  // if it doens't work with 0, try with 1
            this.getField(fname).readonly = true; // makes all fields readonly
        }
  }

Open in new window

Avatar of Mike Rudolph

ASKER

Thank you guys. This helped a lot.
@shogun5 did you try Leakim's solution - it looks like it would be more useful?
Yes I did but the page version did not work.