Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

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

New Here ,
Mar 21, 2017 Mar 21, 2017

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
24.5K
Translate
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
1 ACCEPTED SOLUTION
Community Expert ,
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;

}

View solution in original post

Translate
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
LEGEND ,
Mar 21, 2017 Mar 21, 2017

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.

Translate
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

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

Translate
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 Expert ,
Mar 21, 2017 Mar 21, 2017

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

Translate
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

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

Translate
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 Expert ,
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;

}

Translate
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

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

Translate
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 Expert ,
Mar 21, 2017 Mar 21, 2017

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

Translate
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

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

Translate
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 Expert ,
Mar 21, 2017 Mar 21, 2017

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

Translate
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

Where is teh option of create a button?

Translate
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 Expert ,
Mar 21, 2017 Mar 21, 2017

What version of Acrobat do you use?

Translate
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

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

Translate
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 Expert ,
Mar 22, 2017 Mar 22, 2017

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!

Translate
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

Is it possible doing it with reader version?

Translate
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 Expert ,
Mar 22, 2017 Mar 22, 2017

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

Translate
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

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.

Translate
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 Expert ,
Mar 22, 2017 Mar 22, 2017

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

Translate
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 Expert ,
Mar 22, 2017 Mar 22, 2017

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

Translate
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 ,
Nov 12, 2022 Nov 12, 2022

I know this is from 2017.  I do this with Acrobat Pro but there is no "Execute JavaScript" command in the list when I go tthe actions tab for the button.  If not, how can I add the command?

Translate
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 Expert ,
Nov 12, 2022 Nov 12, 2022

What does you see at the action list?

Translate
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

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!

Translate
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 Expert ,
Mar 03, 2021 Mar 03, 2021

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

Translate
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

@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!

 

Translate
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

@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

Translate
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