Copy link to clipboard
Copied
I want to include a field on a document where the data needs to be scrolled up/down to see the entire contents, but I also do not want readers to remove/edit the contents of said field. (maybe text box is not the right tool)
I have created a text box, gotten it to scroll, but as soon as I lock (and tried with all options I believe to allow/not editing), the box tuns into a static field with the + black box in the bottom right corner, but no way to access to the entire text of the box, or scroll which is the main goal.
So.....is this even possible? Is there a different/better tool than the Text Box itself to accomplish this?
Copy link to clipboard
Copied
Yes, it's possible, using a small hack I came up with a while ago... The way to do it is to set the value you want the field to have as its default value first (under Properties - Options), and then add the following code as the field's custom Keystroke script (under Properties - Format - Custom):
event.rc = false;
This will mean the user could interact with the field by clicking into it, scrolling up and down, etc., but not edit its contents.
Copy link to clipboard
Copied
You can use a text field and two buttons to scroll the text in the field.
Copy link to clipboard
Copied
Hello - I am not sure that I understand what you mean. What two buttons are you meaning? Would said text field be locked (no ability to remove the text in it), but allow it to be moved up/down to view the entire list?
Copy link to clipboard
Copied
Yes, it's possible, using a small hack I came up with a while ago... The way to do it is to set the value you want the field to have as its default value first (under Properties - Options), and then add the following code as the field's custom Keystroke script (under Properties - Format - Custom):
event.rc = false;
This will mean the user could interact with the field by clicking into it, scrolling up and down, etc., but not edit its contents.
Copy link to clipboard
Copied
Well that is amazing.....Thank you very much!!! Now for a curveball......I have two of these boxes, one of which is plain text and hte other has rich text with colors and bolding etc. Is there any way that, using the above approach, I can end up with rich text in the text box?
Copy link to clipboard
Copied
That's more tricky... One thing you can try to do is edit the field so that it has the desired value, and only then apply the Keystroke code. However, if the form is reset it will lost the formatting you applied because the defaultValue is only a string. I just thought of another way to achieve it, though... You can create a hidden text field and as its Calculation event use a code to populate the field with the RTF with its "default" value! That should keep it in tact, even when the form is cleared. And actually if you do it like that then you won't need the Keystroke script at all, as that will overwrite any value the user enters into it anyway.
Copy link to clipboard
Copied
I did not do the hidden text field , as following your recommendationg of pasting in the rich text, then applying the Keystroke script did what I was needing. I think it was a sequencing issue - when to apply the keystroke script and when to paste in the Rich Text. Now the contents of the box cannot be edited , and one shows the plain text and the other rich text. I very much appreciate your help with this. I had talked to a few Adobe support persons who indicated that this was not possible.......
Copy link to clipboard
Copied
Glad to hear you were able to solve it, and it's not very surprising the Adobe support people were not able to help you... They don't usually have much scripting knowledge or experience.
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more