Expand my Community achievements bar.

subforms become hidden after save

Avatar

Level 2

I have a problem where my subforms becomes hidden after i save the form

at first the subform is hidden  but with a checkbox i choose to show it.

When the user saves it and closes the form, and when i open it again the subform is hidden again.

shouldn't the subform stay visible?

6 Replies

Avatar

Level 10

It depends on where you have your script.

For example if the subform is initally set to "invisible" or "hidden" and the script is in the exit event of the checkbox, then the subform may revert to hidden when the form is re-opened.

You could try moving the script to the Layout: Ready event or copy the script to the Initialise event of the checkbox. That way the value of the checkbox will be checked when the form opens and the visibility of the subform should follow.

Hope that works,

N.

Avatar

Level 2

afraid this did not help, as i've tried the layout load and initialize but still no results

i tried doing a simple check on the checkboxes and if rawValue was 1 the subform should be visible but it still won't work.

Avatar

Former Community Member

Sounds like you want to maintain the "state" of your form when you save it. There is an option for this in the File/Form Properties/Defaults under the Scripting section......"Preserve Scripting CHanges to Form When Saved". If you decide to do it yourself then I would put the code on a Form Ready or Doc Ready event. The events that you chose are too early.

Paul

Avatar

Level 10

Hi,

Check a few things:

  1. Form is saved as Dynamic PDF;
  2. Preview of form is interactive in the Forms Properties, Preview tab.

The following Javascript in the Initialise and mouseUp (or Exit) events of the CheckBox should work:

if (this.rawValue == 1)  //1 being the "on" or ticked value
{
    subForm1.presence = "visible";

}
else
{
    subForm1.presence = "hidden"; //can also go for "invisible"

}

The initialise event should check the value of the checkbox when the user opens the form and set the subform visibility accordingly. The mouseUp (or Exit) event should set the visibility depending on the user input when using the form.

If the script is not working it sounds like the form is not saved as Dynamic.

We have a sample uploaded at this topic: http://forums.adobe.com/thread/426690?tstart=30

Hope that works,

Niall

PS: Paul has the answer above...

Avatar

Level 10

Hey Niall, just wondering why you would use the MouseUp event over the Change event. Or is there much difference?

Avatar

Level 10

Hi Jono,

Both are interactive events. I don't think that there is any real difference (not for checkboxes at least) and the script would have the same effect in both. Just down to personal preference, I suspose. I am not sure if one event would be more "correct" over the other.

Regards,

Niall