How to "lock" the form after filling it with the reader version?

New Here ,
Mar 21, 2017 Mar 21, 2017

Copy link to clipboard

Copied

I have been making some PDF for my clients for them to edit information and after that, they send it to third part but, of course, need to "lock" the PDF after using a reader version. Is it possible?

TOPICS
PDF forms, Windows

Views

6.4K

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct Answer

Most Valuable Participant , Mar 21, 2017 Mar 21, 2017
Sure. You can use this code:for (var i=0; i<this.numFields; i++) {    var f = this.getField(this.getNthFieldName(i));    if (f==null) continue;    f.readonly = true;}

Likes

translate

Translate

Translate
LEGEND ,
Mar 21, 2017 Mar 21, 2017

Copy link to clipboard

Copied

You can make the fields read only using JavaScript.

With Digital Certificates you can not only lock field but also add special code to detect any changes since the signing of the form.

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 21, 2017 Mar 21, 2017

Copy link to clipboard

Copied

Can i use java script in adobe reader?

I made a form to send it to my client, after he fill it, he will send to the third part. What we would like is to lock the form only for the third part

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Most Valuable Participant ,
Mar 21, 2017 Mar 21, 2017

Copy link to clipboard

Copied

Depends on what commands you're using. You can set the fields as read-only in Reader using JS, yes.

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 21, 2017 Mar 21, 2017

Copy link to clipboard

Copied

Can you explain to me how to do it with JS?

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Most Valuable Participant ,
Mar 21, 2017 Mar 21, 2017

Copy link to clipboard

Copied

Sure. You can use this code:

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

    var f = this.getField(this.getNthFieldName(i));

    if (f==null) continue;

    f.readonly = true;

}

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 21, 2017 Mar 21, 2017

Copy link to clipboard

Copied

I will sound like a stupid, but i dont really know where to put this code in adobe reader

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Most Valuable Participant ,
Mar 21, 2017 Mar 21, 2017

Copy link to clipboard

Copied

This code will work in Reader, but to apply it to your file you must have Acrobat.

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 21, 2017 Mar 21, 2017

Copy link to clipboard

Copied

I have acrobat. But my client and the third part dont have it, only the reader.

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Most Valuable Participant ,
Mar 21, 2017 Mar 21, 2017

Copy link to clipboard

Copied

That's fine. You can create a "Lock Form" button and attach this code as it's MouseUp action.

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 21, 2017 Mar 21, 2017

Copy link to clipboard

Copied

Where is teh option of create a button?

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Most Valuable Participant ,
Mar 21, 2017 Mar 21, 2017

Copy link to clipboard

Copied

What version of Acrobat do you use?

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 22, 2017 Mar 22, 2017

Copy link to clipboard

Copied

My version is acrobat pro DC, and my client's version is only reader.

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Most Valuable Participant ,
Mar 22, 2017 Mar 22, 2017

Copy link to clipboard

Copied

Go to Tools - Prepare Form, and then use the Button tool to draw your field.

Right-click it and select Properties. Go to the Actions tab. Add new MouseUp triggered event and add an "Execute JavaScript" command, and then paste this code into the window that opens.

Set the rest of the button's appearance properties and you're done!

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 22, 2017 Mar 22, 2017

Copy link to clipboard

Copied

Is it possible doing it with reader version?

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Most Valuable Participant ,
Mar 22, 2017 Mar 22, 2017

Copy link to clipboard

Copied

No! I answered this question multiple times already... You have to set it up in Acrobat and then the code will work in Reader.

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 22, 2017 Mar 22, 2017

Copy link to clipboard

Copied

I dont need to "lock" the form in acrobat, I need to lock it in reader. I create the form, send it to my client and he will fill it and after that he will need to lock the form and send to the third part. So, my client doesnt have acrobat version.

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Mar 22, 2017 Mar 22, 2017

Copy link to clipboard

Copied

When you create the form with Adobe Acrobat you can also add the code.

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Most Valuable Participant ,
Mar 22, 2017 Mar 22, 2017

Copy link to clipboard

Copied

I don't know how to explain it differently... If you follow my instructions it will work.

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Mar 03, 2021 Mar 03, 2021

Copy link to clipboard

Copied

This does work well with a button however, lets say I wanted this code to execute upon being saved in Reader; how would one do that? I tried applying this and similar variations of code under Document Actions "Document Will Save" and it technically works...however I can't even save the form to distribute because it makes everything read only when I save it haha. Any help with this conundrum would be greatly appreciated. Thank you!

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Most Valuable Participant ,
Mar 03, 2021 Mar 03, 2021

Copy link to clipboard

Copied

Well, it's working as advertised... What you can do is disable JS before saving the file, via Edit - Preferences - JavaScript.

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Mar 10, 2021 Mar 10, 2021

Copy link to clipboard

Copied

@try67 This was brilliant! (Once I figured out how to fix the settings after accidentally clicking the yellow Javascript warning and telling it to "Always trust Javascript" for this particular document. Thank you so much for the simple yet brilliant advice!

 

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 24, 2021 Mar 24, 2021

Copy link to clipboard

Copied

@try67 

Hello, I have a question:

Is it possible to add in your code some kind of exception? I want to lock most of the document except a few form fields: e.g. I created a button that will lock all the form fields fiiled in by the applicant, but will leave unlocked some form fields for the administration. Is that possible? I'm not a developer, so I can't code...

I wonder if you would add in the code somewhere, a command in the lines of "lock all form fields readonly= true, but leave "FieldNameXYZ"=false.?

Is this possible?

Thanks in advance and kindest regards,

Nuno

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Most Valuable Participant ,
Mar 24, 2021 Mar 24, 2021

Copy link to clipboard

Copied

Sure. Try this:

 

for (var i=0; i<this.numFields; i++) {
	var fname = this.getNthFieldName(i);
	if (fname=="FieldNameXYZ") continue;
    var f = this.getField(fname);
    if (f==null) continue;
    f.readonly = true;
}

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 24, 2021 Mar 24, 2021

Copy link to clipboard

Copied

Thanks a million for your fast reply 🙂

I'll test it and let you know the result.

In the meantime I got a different script from a friend and it works perfectly.

Tried to share it, but I get this error message from Adobe... so I can't...

Thank you again and kindest regards.

Stay safe,

Nuno

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines