Expand my Community achievements bar.

SOLVED

hidden, but not excluded from layout

Avatar

Level 3

HI,

I am using a dropdown to allow the form user to say whether or not he wants to see a subform.

When I test this, here's the sequence I experience:

1. Initial form opens and the subform is hidden and excluded from the layout. This is good...as intended. I am seeing subforms 1 and 3.

2. I choose to display the hidden form. It appears. Also good and as intended. I am seeing subforms 1, 2, and 3.

3. I choose to hide the subform. It goes away, but it leaves behind a blank page...a big gap...before the next subform. I am seeing subform 1...then a blank page...then subform 3.

I am using "hidden" in my code. I do not understand why the form does not reflow properly.

Many thanks,

Joe

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi Joe,

The problem is the event that you have placed the script. The layoutReady event fires many many times, especially as objects are shown and hidden. If you move your script to the exit event of the dropdown, I am sure it will work.

If that doesn't work, can you share your form? Upload to Acrobat.com or another file sharing site and share the published link/url here.

Here is an example: https://acrobat.com/#d=IFY2ZMg4G9XZmJnJJNSw*w

This shows/hides objects on a button click, but the same basic approach will work for other objects, like scripting the Yes/No dropdown.

Good luck,

Niall

View solution in original post

6 Replies

Avatar

Level 10

Hi Joe,

Two possible things:

  1. Is the form saved as a Dynamic XML form in the save as dialog?
  2. If the subform/page that contains all three subforms set to flowed?

One other unrelated point is to set the 'preserve script changes' in the File > Form Properties > Default tab to 'Automatic'. Its not cause the problem here, but is a good way to make sure the form looks the same when the user reopens it in Acrobat/Reader.

Hope that helps,

Niall

Avatar

Level 3

Hi Niall,

Thanks very much for the fast response.

The form is dynamic and the container is flowed.

I think the problem is my code. I am an amateur.

I tried it in a much simpler form and had the same issue. Using this code, the form can expand...but cannot contract.

Any suggestions? This is a YES/NO drop down inside of Subform1:

form1.#subform[0].Subform1.eq_question::ready:layout - (JavaScript, client)

if (this.rawValue == 1) {Subform2.presence = "visible";}

if (this.rawValue == 2) {Subform2.presence = "hidden";}

Thanks,

Joe

Avatar

Former Community Member

Even if the subform is hidden the form has to reserve space for it.....instead of hiding it I suggest that you remove it using the instanceManager method.

Paul

Avatar

Correct answer by
Level 10

Hi Joe,

The problem is the event that you have placed the script. The layoutReady event fires many many times, especially as objects are shown and hidden. If you move your script to the exit event of the dropdown, I am sure it will work.

If that doesn't work, can you share your form? Upload to Acrobat.com or another file sharing site and share the published link/url here.

Here is an example: https://acrobat.com/#d=IFY2ZMg4G9XZmJnJJNSw*w

This shows/hides objects on a button click, but the same basic approach will work for other objects, like scripting the Yes/No dropdown.

Good luck,

Niall

Avatar

Level 3

THANKS NIALL!

That's my biggest failing...those events. I have only a vague idea of which ones to use.

This is wonderful. Thanks for your solution.

Joe

Avatar

Level 10

Glad you have it working

I have a summary of how often events fire here:

http://assurehsc.ie/blog/index.php/2010/05/how-often-events-fire-and-their-sequence/

I am working on another sample, but it is no where near being finished yet.

Check out the help file, as there is a good description of events there.

Niall