Can I hide and unhide the picture using button?

New Here ,
May 26, 2022 May 26, 2022

Copy link to clipboard

Copied

one Button created. also imported .png file. When I click the button It hide the picture and When I click the button again it unhide the picture.    (I want to do like that)   How can I do? plz help me!

 

Screenshot 2022-05-27 104729.png

 
TOPICS
How to , JavaScript

Views

102

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 2 Correct answers

Adobe Community Professional , May 26, 2022 May 26, 2022

In 'Prepare form' tool you can add 'image field' close 'Prepare form' and click on that field to import image.

Now in  a button as 'Mouse UP' event, select 'Run a JavaScript' and enter this script and make sure field name is same as your actual field name:

this.getField("Image1_af_image").display = this.getField("Image1_af_image").display == display.visible ? display.hidden : display.visible;

Likes

Translate

Translate
Adobe Community Professional , May 27, 2022 May 27, 2022

The only way to hide an image with a script is if that image is the icon of a button field, or if you use a button (or any other type of field) to hide it underneath it. Either way, it will require using a script, like the one Nesa provided above.

Just to clarify, though, when the image is hidden there will be a white gap on the page. It will not cause the rest of the page's contents to "reflow" and fill that gap.

Likes

Translate

Translate
Adobe Community Professional ,
May 26, 2022 May 26, 2022

Copy link to clipboard

Copied

In 'Prepare form' tool you can add 'image field' close 'Prepare form' and click on that field to import image.

Now in  a button as 'Mouse UP' event, select 'Run a JavaScript' and enter this script and make sure field name is same as your actual field name:

this.getField("Image1_af_image").display = this.getField("Image1_af_image").display == display.visible ? display.hidden : display.visible;

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 11, 2022 Jun 11, 2022

Copy link to clipboard

Copied

LATEST

Thanks.

 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
May 27, 2022 May 27, 2022

Copy link to clipboard

Copied

The only way to hide an image with a script is if that image is the icon of a button field, or if you use a button (or any other type of field) to hide it underneath it. Either way, it will require using a script, like the one Nesa provided above.

Just to clarify, though, when the image is hidden there will be a white gap on the page. It will not cause the rest of the page's contents to "reflow" and fill that gap.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines