Expand my Community achievements bar.

Radically easy to access on brand approved content for distribution and omnichannel performant delivery. AEM Assets Content Hub and Dynamic Media with OpenAPI capabilities is now GA.

Disable scrolling for an entire document

Avatar

Former Community Member
Can anyone help me with a code sample that will disable scrolling for an entire document?
9 Replies

Avatar

Former Community Member
If you're wanting to prevent the user from being able to scroll the document window when viewing a form in Acrobat as PDF, I don't think this is possible. The Acrobat API doesn't expose functionality to turn-off a document's scroll bars.



You may also be referring to how a multi-line text field will scroll as the user adds more lines of text where the total text can't fit inside the text field's visible area.



Were you inquiring about disabling the scroll bars in an Acrobat Document or preventing the user from entering more text than can fit in the visible area of a text field?



Stefan

Adobe Systems

Avatar

Former Community Member
I would like to know if it is possible to disable the scroll bars in a multilined textbox. In otherwords, give it the same properties as a multilined text box created using Adobe Professional.



Ben

Avatar

Former Community Member
I assume, then, that you're referring to the "do not scroll" property that you can set on an AcroForm field which will effectively disable the scroll bars for that field by limiting the content to the field's visible area.



If that's the case, I would recommend you have a look at post #1 in the
Disable Scrolling Text thread.



If that's not what you were referring to, please give me more details on the specific properties you're setting when you create the multi-lined text box in Acrobat Pro.



Stefan

Adobe Systems

Avatar

Former Community Member
What I'm looking for is how to disable scroll bars for all multi-lined fields in a form. The post you referred to will work for a single field, and it is helpful, but what I'd like to do is to put a one-time script in at the form level that would disable scrolling for all fields. Is this possible?

Avatar

Former Community Member
Sure! You could write a script which is executed from the top level subform's ("form1" by default) Enter event and looks for all fields on the form and sets their
doNotScroll property to true. Note that the script will have to execute on the Enter event (which will be called the moment the user sets focus to any field on the form) because any other event is too "soon" for the
doNotScroll property setting to take effect.



I've attached another sample form which demonstrates how to do this. Check-out the script in the form1 object's Enter event. The
DisableScrolling method is recursive and finds all child fields within all possible container objects (such as subforms, areas, exclusion groups) found in the XFA language. For each field found which supports the
doNotScroll property, it sets that property to true. Note the boolean variable used to guard against running this script every time focus is set to a field within the form. The script only needs to be executed once.



Stefan

Adobe Systems

Avatar

Former Community Member
Hello,



This is really helpful and much appreciated. However, there is a bug with it. If you make a subform invisible or hidden, this script fails.



Is there anyway to make this work on any field visible or not? At this time, any fields that are invisible by default don't get the setting (assuming I alter the script to skip null returns from getField.)



Thanks

Avatar

Former Community Member
What is the script for disabling the scrolling throughout the entire document? I don't know where it is. I downloaded the sample but there is nothing in the script editor.

Avatar

Former Community Member
Look in the enter event on form1 and the script object "ScriptObject." You will see all the code in those two locations.



I've had to modify the script to check for null returns from getField since invisible objects don't have an associated AcroObject until the become visible. That presents some interesting challenges.



Cheers

Avatar

Former Community Member
Hello,



I found another problem with this script. It turns out that fields in a table will get the setting, the first time you enter text in the field. However, if you exit the field and return to it later, you can type as many characters as you want.



I had to set the property every time you entered the field.



Cheers