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

PLEASE HELP! Convert Text Fields to Read Only After Text Input

New Here ,
Sep 04, 2020 Sep 04, 2020

Copy link to clipboard

Copied

Is there a way to make a form field in a pdf switch to read only after a user supplies an input value to the text box?

 

Basically I have a design I converted into template that my client wants to send to different branches and have them personalize it by adding in their own information to make it local. Since the branches can email them to customers, it cannot look like it was a template and so I need the fields to disappear and only show the text. 

 

Read only is the only way I found that makes the fields inactive. But I cannot find a way or a script that converts them to read only after input. Also I have to keep in mind that most branches will only have Reader.

 

Any help would be very much appreciate!

I have been trying to figure this out for days with no luck and I have to get it back to my client as soon as I can.

 

(I am pretty sure that none of the recipients would know how or have an e-signature to sign it in order to lock it up that way)

TOPICS
Acrobat SDK and JavaScript

Views

390

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 Expert ,
Sep 04, 2020 Sep 04, 2020

Copy link to clipboard

Copied

That's not a good idea. If you want to allow the users to "lock in" their replies the best option is to have them digitally sign it, which is not that complicated. Short of that the second best (by far) option is to set the fields as read-only, but you should not that do that as soon as they enter something into them. What if they made a mistake and what to fix it later on?

A better solution is to add a "Finalize Form" button and set it to make all the fields as read-only, and then hide itself. This can be done using a script.

Votes

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 ,
Sep 04, 2020 Sep 04, 2020

Copy link to clipboard

Copied

Thank you so much for your response!

My original thought was the digital signature as well. I added a little note at the bottom of post saying that I am pretty sure that the digital signature is not a viable option for the people that are going to be filling it in. A lot will be older and not technologically savy.

The finalize form button was the only thing I tried to do but failed, I couldn't get it to work. The script I was using on the button was on the mouse up. It basically read, get the names of all fields, change access to read only on each. I got it from an older post on a non-adobe forum. I don't have the exact script I used cause it didn't work and I deleted it. Thought it was maybe outdated.

Do you have a recommendation on how to do the form finalizing? Or a script that works lol?

Thanks again!

Votes

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 Expert ,
Sep 04, 2020 Sep 04, 2020

Copy link to clipboard

Copied

LATEST

The basic description of the code is correct. Maybe there was a problem with the implementation of it, though.

Try this code:

 

for (var i=0; i<this.numFields; i++) {
	var f = this.getField(this.getNthFieldName(i));
	if (f==null) continue;
	f.reaodnly = true;
	f.defaultValue = f.valueAsString;
}
event.target.display = display.hidden;

Votes

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