Expand my Community achievements bar.

SOLVED

Image Presence

Avatar

Level 1

Hi,

I am trying to control the presence of a few iamges based on the value of a dropdown list. However, I can't seem to get it to work. i have the document saved as dynamic and have the following code in the dropdown list's intialize and exit events:

if (this.rawValue == "A")

{

topmostSubform.Page1.Image1.presence

= "visible";

topmostSubform.Page1.Image2.presence

= "invisible";

topmostSubform.Page1.Image3.presence

= "invisible";

}

else

if (this.rawValue == "B")

{

topmostSubform.Page1.Image1.presence

= "invisible";

topmostSubform.Page1.Image2.presence

= "invisible";

topmostSubform.Page1.Image3.presence

= "visible";

}

else

{

topmostSubform.Page1.Image1.presence

= "invisible";

topmostSubform.Page1.Image2.presence

= "visible";

topmostSubform.Page1.Image3.presence

= "invisible";

}

Thanks!

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi,

Here is an example, which I created for you by importing a PDF into LC Designer. http://assure.ly/mNe67K

Hopefully you can follow this.

Here are some more examples that may help:

Also here is an example that explains about referencing objects: http://assure.ly/kUP02y

Hope that helps,

Niall

View solution in original post

6 Replies

Avatar

Level 10

Hi,

The script looks okay, so I would make absolutely sure that the form is saved as a Dynamic XML Form in the save-as dialog.

LC SaveAs Dialog.png

From the "topmostSubform", it looks like you have created the form by importing either a Word or PDF document. Depending on how you have done this, will affect wheither you can actually save the form as a Dynamic XML Form.

Other than that you should check the object references to the image objects.

Lastly, it is a good idea to open the JavaScript Console when debugging a form. Control+J. This should show up errors at runtime. You should be able to open the JavaScript Console when Previewing the form in LC Designer or in Acrobat.

Hope that helps,

Niall

Avatar

Level 1

Thanks for the reply Niall. I double checked all of the suggestions. The form is a Dynamic XML, the references seem correct, and no errors come up in the console. You are correct that I imported this from a PDF. How might this affect my scripting goals?

Avatar

Level 10

Hi,

When importing the existing PDF you will have been presented with options, if you selected that you wanted a static layout to presserve the look, then you may not be able to have all of the dynamic functionality.

Check out the help file for description of limitations.

When dealing with dynamic requirements I would recommend working in LC Designer from scratch.

Does the form work in Acrobat? Or are you testing in Preview/LC Designer?

Can you share the form? If so, upload it to a file sharing site, publish it and then post the published URL here.

Niall

Avatar

Level 1

Unfortunately I can't share the form. Basically I need to take a file that was published to pdf and overlay a few dropdown list objects that control the visibility of overlayed images (as suggested by the code). I imported with the flowable layout option, and I've mostly been using preview in LC. It would be fairly impossible to recreate the pdf from scratch (its complicated and not standard). Your suggestions are appreciated.

Avatar

Correct answer by
Level 10

Hi,

Here is an example, which I created for you by importing a PDF into LC Designer. http://assure.ly/mNe67K

Hopefully you can follow this.

Here are some more examples that may help:

Also here is an example that explains about referencing objects: http://assure.ly/kUP02y

Hope that helps,

Niall

Avatar

Level 1

Thanks Niall, I was able to follow the script in your form and mine works great now. Thanks so much for the help!