Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

How do I create a flexible PDF with hide and show?

Avatar

Level 2

Hello,

It's a flexible PDF document but i don't know how to create it with hide & show.

My form has the following structure:

form1

     master pages

          page1

               ...

               Teilnehmer ( has the following skript because of the button "ZeileHinzufuegen"

                    weitere

                         Subweitere

                              Textfield

                              ...

                              Line

                              ...

                              Button

                         ZeileHinzufuegen

skript of "ZeileHinzufuegen" in "Teilnehmer", too:

Formular1.Page1.Teilnehmer.ZeileHinzufuegen::click - (JavaScript, client)

oHelper.addInstance(parent.weitere._Subweitere);

If I click "ZeileHinzufuegen", another line with textfields... shall appear.

How do I create this?

Thanks in advance for helping me

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi Matthias,

The script look good!!

I know you have tried this previously, but becuase the radio button group and the Hotel subform are in the same container (Anreise) then you could shorten the reference. This is not the problem, but it will make it cleaner.

if (this.rawValue == 1)

{

     Hotel.presence = "visible";

}

else

{

     Hotel.presence = "hidden";

}

The form should be saved as Dynamic:

Parallels Desktop1.png

Apart from that I am not sure what is going wrong. Can you share the form? It would make it easier.

The second sample is shared on Acrobat.com, you should not have to register in order to have access to it. I would suggest retrying again and selecting download file. I have uploaded to another service: http://dl.dropbox.com/u/8257540/2010-04-03%20Looping%20through%20repeating%20rows.pdf

Niall

View solution in original post

13 Replies

Avatar

Level 2

I've got a second example a little bit different to the other one:

this form has the following structure:

form1

     master pages

     page1

               ...

               Anreise ( has the following skript because of the radio button. yes

                    Hotel

                         ...

                    radio button

                         unknown

                         yes

                    ...

     ...

skript of "yes" (of course in "Anreise" and "radio button", too):

If I click "yes", all textfields... in the map "Hotel" shall appear.

How do I create this?

Thanks in advance for helping me

Formular1.Page1.Anreise.Optionsfeldliste.ja::click - (JavaScript, client)

oHelper.setInstanceCount(this.rawValue

, Anreise._Hotel);

Avatar

Level 10

Hi,

You can achieve this by accessing the presence property of the objects. For example you can change an objects presence by setting presence to hidden or visible.

The form must be saved as Dynamic.

Here is a sample: https://acrobat.com/#d=MnqBQrsWVc5gKwQFC9TyZA

Check out the script in the exit event of the radio button group.

Hope that helps,

Niall

Avatar

Level 2

Hi,

thank you for helping me! I think this is a good hint for my second example. So I've tried two scripts. Poorly without success.

the first one with Page1.Anreise. the second one without it.

Formular1.Page1.Anreise.ja::click - (JavaScript, client)

if

(this.rawValue == 1) {

Page1.Anreise.Hotel.presence

= "visible";}

else

{ Page1.Anreise.Hotel.presence = "hidden"; }

Formular1.Page1.Anreise.ja::click - (JavaScript, client)

if

(this.rawValue == 1) {

Hotel.presence

= "visible";}

else

{ Hotel.presence = "hidden"; }

Do you know where the mistakes are? And do you have a good hint for my first problem, too? Thanks in advance!

Avatar

Level 10

Hi,

The script in the first attempt looks good. Check that the script is in the radio button group and not in the individual choices.

Safari1.png

Also confirm that in the Object > Binding tab that the radio button group have values = 1 (and = 0). This is what you are testing against.

Check the reference to the objects. A good tip is to select the object that you want to put the script into, then scroll so that you can see the object you want to reference. Enter into the script editor when the first object is selected and hover the mouse over the second object. When you press and hold the Control key the mouse changes into a 'V'. Click on the second object and LC Designer will insert sufficient reference for the object.

Without seeing the form it is difficult to see what else may be the problem.

Here is a sample for the first problem: https://acrobat.com/#d=byrO8kt0Sm6t*wyOS7sxGw

If you check out the script in the "+" button. Row1 is set to be repeatable in the Object > Binding tab. The underscore in front Row1 (_Row1) is shorthand for instanceManager. The form is also saved as Dynamic and the table is in a Flowed subform.

Hope that helps,

Niall

Avatar

Level 2

I've followed all your hints but I can't find the mistake. Here's a screenshot of the form.

Form.png

To your second hint: I need to be registered at acrobat? The first time I opened your link I could choose whether I want to save the file or open it. The second time not?!

Matthias

Avatar

Correct answer by
Level 10

Hi Matthias,

The script look good!!

I know you have tried this previously, but becuase the radio button group and the Hotel subform are in the same container (Anreise) then you could shorten the reference. This is not the problem, but it will make it cleaner.

if (this.rawValue == 1)

{

     Hotel.presence = "visible";

}

else

{

     Hotel.presence = "hidden";

}

The form should be saved as Dynamic:

Parallels Desktop1.png

Apart from that I am not sure what is going wrong. Can you share the form? It would make it easier.

The second sample is shared on Acrobat.com, you should not have to register in order to have access to it. I would suggest retrying again and selecting download file. I have uploaded to another service: http://dl.dropbox.com/u/8257540/2010-04-03%20Looping%20through%20repeating%20rows.pdf

Niall

Avatar

Level 2

Good Morning Niall,

sorry, I was too busy yesterday. But thanks for your quick answers!

Ok, I've shorten the script into your version. But I can't save it as a dynamic one. Why? I've imported it like this:

(File, NewFile, import PDF, source, next,) interactive form with flexible layout. ... Is this the mistake? Otherwise, is there no other way as to share it in two pages?

Matthias

Avatar

Level 10

Hi,

This may be the problem. When you import an existing PDF or Word document, you lose some of the LC Designer functionality. I suspect that this is why the option to save as dynamic is greyed out.

It is always better to start with a blank form in LC Designer natively.

If the form is not too large, you could try copying each page into a new form and then try saving that as dynamic.

You script looks good and should work OK.

Hope you get it working,

Niall

Avatar

Level 2

Hi,

I've copied it in a new blank form and it works. Thank you!!!

To my second problem:

I've downloaded the file and shortened it to the necessary fields:

yours.png

I've done the same with mine:

yours changed in my version.png

but it occurs an error:

Error.png

Moreover I want that by clicking the button, more fields than one like in your version, were added. So where do I write the script? In every field which should be added? Or in the upper class?

Thanks in advance!

Matthias

Avatar

Level 10

Hi Matthias,

Progress!!

The error seems to indicate that the language is set to FormCalc, where it should be set to JavaScript. Changing that in the script editor should get rid of the error.

If you have a number of fields to add, I would wrap them in a subform and then have the script add an instance of the subform.

Hope that helps,

Niall

Avatar

Level 2

Hi Niall,

ok, I've changed the language into JavaScript. No error alermed anymore but it doesn't work.

Thanks in advance!

Matthias

Avatar

Level 10

Hi Matthias,

Just to be clear, the original question related to showing and hiding objects (or subform). Is that working OK?

The latest issue seems to relate to adding instances (based on the error message). If this is the case then there are a few settings that you need to make for this to work.

  • The repeating object must be set to repeat in the Object > Binding tab:

Parallels Desktop1.png

  • The object must be inside a flowed subform, to make space on the page for the new instances.

Parallels Desktop1.png

The form is already saved as Dynamic, so that should get it up and running.

I have an example of a form with a repeating row here: https://acrobat.com/#d=tdpzltrl25yU2PkvgaQO9w which may help.

Niall

Avatar

Level 2

You're rigth. It has nothing to do with hide and see - as I mean - that's why I start a new discussion here:

http://forums.adobe.com/thread/669988