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)
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.
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!
Copy link to clipboard
Copied
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;