ComputersConsumer ElectronicsCell PhonesHome Theater & AudioGraphic Design & Video EditingInternetIndustrial Technology

How to Change a PDF Form to Read-Only Before the User Submits

Updated on April 17, 2017

Finding The Right Solution For Your User

Interactive PDF forms are very useful for a variety of projects. It is a great alternative to web forms while keeping the same interactive attributes. Interactive PDF forms are not only easy to create, they are accessibly on multiple platforms creating a solution for a wide variety of needs.

In the first tutorial I go over how to create the actual form with text fields, buttons, radio buttons and the reset/submit actions. Adobe Acrobat has a lot more to offer than just basic forms, and is an incredible tool for businesses. There are specific situations where the fields need to be editable for the user to fill out, but when the information is submitted to its designated destination, the information needs to be locked so that it cannot be changed on the receiving end.

There are a few different solutions to this such as having the user save as an image and then email, or to change the form to read-only on their end before sending. As I have mentioned in several other hubs, the ultimate goal is the make the task as easy as possible for the user. By requiring the user to do extra work it leaves a lot of room for error, whether they forget to complete a step or they don't understand the instructions. Not only is this not efficient for your user, it may also deter users from completing the information that you need out of frustrations.

Select Trigger "Mouse Up"
Select Trigger "Mouse Up"

Choose "Run a JavaScript"

Next, go to the drop down for “Select Action” and choose “Run a JavaScript”.Once you choose this, another box will appear that will allow you to enter code.

Adding a Simple Script

The best way to make a PDF form read-only on the receiving end is to add a simple script to a button that will be selected before submitting the form. This button can be as simple as adding text such as “I agree that this information is correct” or even saying “by clicking here you are submitting your digital signature”. The button itself when selected will run a quick script that will make the PDF read-only, and then the user can select the “submit” options to complete the task. The process listed below is to make all fields in the entire form read-only with one script.

The first step is to create a space on your form for the button with the text that you choose.

Once you set your “general” options for your button, go to “actions” and select “Mouse Up”.

Add The Following Script

Add the following code and choose “ok”:

for (var i = 0 ; i < this.numFields ; i++) {
var f = this.getField(this.getNthFieldName(i)) ;
if (f.type != "button") // do I have to change the word between " " with the name of my button which I put on my PDF? name of button is "Valider"
{
f.readonly = true ;
}
}

Once you choose ok that screen will close, and you should now see the added action in your action field.

When it has been successfully added, you will see that it appears in the "actions" field.
When it has been successfully added, you will see that it appears in the "actions" field.

Now You Need The Button to be Required

Save your PDF Interactive form, and you have now created a button with a script to make the form 'read-only' before sending it to the targeted recipients.

For this to work effectively, you need to make sure the user checks the button that you have created. You now need to make that field required.

Go back to your button settings and choose the “general” tab. Under “common properties” check the box “required”. Choose “close”, save your form again and now the user must click that button to be able to send the form. When they choose that required button the form will be changed to a read-only PDF.

Interactive PDF forms are a great alternative to web forms, and can be used for a variety of projects. They are easy to create, accessible for a wide variety of users and can be printed, saved or emailed when submitting.

© 2012 dappledesigns

Comments

    0 of 8192 characters used
    Post Comment

    • profile image

      Tulasi 2 months ago

      Thank you for the explanation on how to make a fillable form read only. Can you let me know how to create a pop up confirmation (OK or Cancel) that the user has done with his changes and wants it to be converted to read only format. When cancel is chosen to go back to form as fillable.

    • profile image

      Vanessa 4 years ago

      Me again... I found that this doesn't work after you enable usage rights... please help!

    • profile image

      Vanessa 4 years ago

      Thank you thank you thank you... i've been searching for days through web pages and forums and no help at all until I found your script! Works like a charm!

    • dappledesigns profile image
      Author

      dappledesigns 4 years ago from In Limbo between New England and the Midwest

      @Eros - I think I understand now what you are asking. By choosing the "read-only" button, the script is initiated to run. Depending on the version of software, it will sometimes default to run when submitted. When you go in to set the "mouse up" options of the action on the button (the check mark to run the script) you should be able to go in and choose when to run the action. For example, if you choose for the script to run only when the form is submitted, as opposed to when the box is checked. You can also choose to add a "reset" button on the form. In the reset options, you can have it reset all fields and scripts when used. This will clear all info already put in the form, but it will release the script.

    • profile image

      Eros 4 years ago

      further to my previous post: the reason seems to be that even if the check mark is removed from the check box (which by the way needs to be done in editing mode since the script also turn the check box as read-only), the read-only status is left on all of the other fields and if something needs to be revised, first you need to remove the read-only mark in editing mode before you can edit the field. What I would like to have is that that when the (hidden) check mark is removed, all fields turn again editable. Hpe you can understand what I want :)

    • profile image

      Eros 4 years ago

      I still cannot make it work like would: I can create the button with script which makes the form read-only. But I cannot turn the document back to read-and-write, even if the button is unchecked / read-only check removed / entire button and script removed.

    • dappledesigns profile image
      Author

      dappledesigns 4 years ago from In Limbo between New England and the Midwest

      @Eros - only the user that filled out the form can change it back to revise. They can uncheck the required button and from there edit and resend. The recipient can not change the information.

      @Pablo - I'm so glad you found it helpful!

    • profile image

      Pablo 4 years ago

      Thank you very much!! I've been looking for a simple script to lock pdf file for quite a while. This fits the bill exactly.

    • profile image

      Eros 4 years ago

      This was very helpful, thanks. However, is there any way to turn the read-only form back to accessible, if something needs to revise etc.?

    • dappledesigns profile image
      Author

      dappledesigns 4 years ago from In Limbo between New England and the Midwest

      Did you create the read-only button after the submit button was created?

    • profile image

      Carol 4 years ago

      This is helpful, thanks! However, when it turns into a read-only form the Submit/Email button is deactivated as well, so the user can't submit the form. Any help with that would be appreciated.