Copy link to clipboard
Copied
Hello.
Basically, I have 120 fields and I need them to be displayed in groups of 30.
So, there are 4 buttons:
This works and does exactly what I want, but it is a bit laggy, taking a few seconds for each button to perform its actions.
So, I tried to solve this in some way and arrived at the following "solution":
I left the 120 fields hidden, and created new 30 fields to just display the information.
Now, when clicking on the buttons, they do not hide/show, but exchange information between them, thus displaying only the 30 that I want, according to the button that is pressed.
It worked, but it got even more laggy.
And now, I'm out of ideas.
So I come here to ask: Is there any less laggy way of dealing with this?
Thanks.
Copy link to clipboard
Copied
Are there fix content in the fields or can the user change the content?
Copy link to clipboard
Copied
The user can change the content of the 120 fields freely.
Copy link to clipboard
Copied
Any ideas?
Copy link to clipboard
Copied
Are you using a script to hide/show fields? If so, then there are a couple of options for setting how fields are hidden and shown that may help.
A) first, is the delay purely about drawing, or are there any value changes that take place when the fields are shown and hidden. Value changes trigger calculations that may be reducing performance.
B) Next, changing the visibility of sevearl individual fields causes several individual page redraws. There are a few things that can make this a single redraw.
1) There is a parameter that will delay drawing, "doc.delay". Set this to true before changing visibility, then set to false.
2) Use group naming on your fields, then just set the group to visible or hidden. You should be doing this anyway, because it makes everything easier to handle.
See the section on field names here: https://www.pdfscripting.com/public/PDF-Form-Scripting.cfm
3) Put the fields on an OCG Layer. Then change the visibility of the layer. This is an option available to designers that create forms with InDesign. But it can also be done in Acrobat with a plug-in available here:
Copy link to clipboard
Copied
Yes. I'm using a script to hide and show the fields, and I did it in groups, just like you said. And they just hide and show, there is no calculation involved.
I tried to use doc.delay, but was unsuccessful. The button just stopped working.
In this case, I put the script for the button inside a function, which is in the document-level javascript window.
Here's what the code for the first button looked like after placing the doc.delay you said:
function aba1() {
doc.delay = true;
this.getField("BP1").display = display.visible;
this.getField("BP2").display = display.hidden;
this.getField("BP3").display = display.hidden;
this.getField("BP4").display = display.hidden;
doc.delay = false;
}
Is that correct?
After inserting it, the button did not respond at all.
About OCG Layer and the plugin you mentioned, I haven't tried it yet, but I will try soon and give you feedback.
Many thanks for the reply!
Copy link to clipboard
Copied
Replace "doc" with "this".
Copy link to clipboard
Copied
In most Acrobat document scripts, "this" is a pointer to the document object. So, as Try67 states, replace "doc" with "this". In exactly the same way you are using "this" with the "doc.getField()" function.