Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.

Scrolling in Read Only Text Fields

Avatar

Level 10
Good evening,



I am using a second dynamic PDF form to import XML data from a form completed by a user. The purpose of the second form is to score the User's responses. To maintain integrity I have set the text fields to "Read Only", so that the User's responses cannot be interfered with during the scoring process.



In the original form when the text field is active there are scroll bars. However when I set the text field to read only, the scroll bar is not available.



Is there a way of having scroll bars on a Read Only Text Field?



Thanks,



Niall
4 Replies

Avatar

Former Community Member
Unfortunately, setting a field to read-only -- or even "protected" for that matter -- will render the field unscrollable in Acrobat.



As a work-around, you could leave the fields accessible (editable) so that the scroll bars remain active and then use script to store the original value of the field when it gets focus (user clicks or tabs into it) and restore the field's original value when the user leaves the field. The user would be able to change the field's value but the value would get restored the second they tab out or click somewhere outside the field.



I've attached a form that contain a text field which has such a script. The form is setup with a Script Object named Utils which contains a variable. The text field's Enter event contains JavaScript (must use JavaScript since we're using a Script Object) which temporarily stores the text field's value in the Script Object variable. The text field's Exit event then has JavaScript which restores the text field's value to the original value contained in the Script Object variable. If you try to modify the text field's value, it'll just get restored when you click or tab out of it.



Stefan

Adobe Systems

Avatar

Level 10
Thanks Stefan,



Lovely script. I tried your file in Acrobat and it did exactly as it said on the tin.



I copied the Javascript for both the Enter and Exit events and while it would show the scroll bars, it would not restore the original content. (aaaaaggghhhhhhhh!).



On a positive note the Client liked it when I showed it to him today.



It's too late in the day now, I will tackled it again in the morning.



Thanks again, Niall

Avatar

Former Community Member
You're welcome. I'm glad your client liked the solution.



Just to be sure, when you copied the Enter and Exit event code, did you remember to set the Language to
JavaScript? By default, the language is set to
FormCalc, I believe, this can't be used for this solution (because of the Script Object).



Stefan

Adobe Systems

Avatar

Level 10
Hi Stefan,



Sorted - I had not created the variable script called "Utils" and that is why the revert was not working. Everything is fine now.



Thanks again.



Niall