Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

Need some more scripting help

Avatar

Level 10

[I'll be posting this over on the Google Group forum too.]

File is here: https://acrobat.com/#d=m7zuQYiUoFrtz5isD7rErQ

Form is a series of tables that can expand and contract their respective rows by clicking a button in the header - tables start out collapsed and filler can open the appropriate tables. I'm using + and - values on the buttons to check what they should do - they call a script object which handles looping through the table rows, etc (thanks Niall!).

I also have similar loops set up on prePrint and docReady (on the form1 root) events so that the tables collapse down to only used rows for printing or after the form is saved and re-opened.

I'm having a few issues that I'm having trouble figuring out. I'm thinking some of the problems might even have to do with which events I'm using but not sure.

Resetting the value of the +/- button in the header rows:

Unless a table is expanded and has rows that are empty showing I want the button caption to be a +. I've been trying to explicitly set this as part of the different loops but seem to be having issues.

Problem with repeating header button caption:

If a table breaks across a page, the button in the repeated header row doesn't reflect the caption of the button in the parent header row. I kind-of fixed this with some code from Paul Guerett which sets the caption based on xfa.layout.pageSpan and it works but if you click the repeated button again to collapse the table the main button caption doesn't update (should change back to a +), unless you click on the main button.

Related to this one is when the file is saved and re-opened table headers that had been repeated show random multiple time (2-5 generally).

I also ran into some trouble with Reader when using Unicode characters for the button caption. Instead of +/- I was trying to use \u25BC and \u25B2 (down and up triangles) but Reader seemed to choke on it.

This form is ready to go except for these couple of issues that I can't seem to track down.

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi Jono,

Here is the form with a few mods: https://acrobat.com/#d=rXwdoCcfDC0pWQz-39KWjg

In relation to the repeating headers, I think the main problem is that the HeaderRow was set to repeat in the Object > Binding tab. I have deselected this. However you would need to test. I have seen this before and to get over it I have wrapped the header in a separate subform. I don't want to do it here because of the scripting, but see how you get on.

On the reset button, I have included a execEvent for the docReady event in the form1 node. This resets the "+".

Where a table spans more than one page (generating another "-" button). I have included another line to reset the original button back to "+":

xfa.resolveNode("HeaderRow[0].Button1.caption.value.#text").value = "+"; 

This seems to work.

I haven't looked at the unicodes. I would stick with the +/-, as these are self evident and you will be less likely to have compatibility problems.

Form looks good!

Good luck,

Niall

View solution in original post

5 Replies

Avatar

Correct answer by
Level 10

Hi Jono,

Here is the form with a few mods: https://acrobat.com/#d=rXwdoCcfDC0pWQz-39KWjg

In relation to the repeating headers, I think the main problem is that the HeaderRow was set to repeat in the Object > Binding tab. I have deselected this. However you would need to test. I have seen this before and to get over it I have wrapped the header in a separate subform. I don't want to do it here because of the scripting, but see how you get on.

On the reset button, I have included a execEvent for the docReady event in the form1 node. This resets the "+".

Where a table spans more than one page (generating another "-" button). I have included another line to reset the original button back to "+":

xfa.resolveNode("HeaderRow[0].Button1.caption.value.#text").value = "+"; 

This seems to work.

I haven't looked at the unicodes. I would stick with the +/-, as these are self evident and you will be less likely to have compatibility problems.

Form looks good!

Good luck,

Niall

Avatar

Level 10

Saved by Niall again!

I figured the button trouble was trying to figure out how to access the correct instance once again...one of these days!

Ya, I'll be dumping the unicode characters...too bad though because the triangles looked pretty good. Problem was, there is no way I could find to specify unicode in the caption field. I had to set it via scripting. Reader definitely didn't like it.

There's still a little bit of oddness happening, but no show stoppers.

Avatar

Level 10

How about this... Wingdings 3 font (with tooltips). Would depend on availability of this font, however it is shown as built-in.

Acrobat.png

Sample here: http://dl.dropbox.com/u/8257540/2010-07-06%20Wingdings%203%20font.pdf (can't get into Acrobat.com)

Niall

Avatar

Level 10

I'm letting it go with +/-, already spent enough time screwing with it! KISS and all that.