Highlighted

Creating a disappearing Add Image Button

New Here ,
Aug 27, 2020

Copy link to clipboard

Copied

Hello there,

 

I'm trying to create a form that has a labeled image insertion section.  To do this, I put text instructions "Click here to Add Image" in the middle of where I want the image, then I added the Image field with "no fill" on top of that text.  This worked great when I inserted a jpeg file because the image covered up my text.  But then I tried inserting a pdf into this space, and my "Click here" text shows right through. (see image).  How do I make it so that when someone inserts the image, the text disappears? Thank you!

 

text.png

Most Valuable Participant
Correct answer by try67 | Most Valuable Participant

You can change the fill color of the field when it is clicked, like this:

 

event.target.fillColor = color.white;

if (event.target.buttonImportIcon()!=0) event.target.fillColor = color.transparent;

 

The last line of code will change it back to transparent if the user didn't select an image or it failed for some reason.

TOPICS
Create PDFs, How to, PDF forms

Views

43

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

Creating a disappearing Add Image Button

New Here ,
Aug 27, 2020

Copy link to clipboard

Copied

Hello there,

 

I'm trying to create a form that has a labeled image insertion section.  To do this, I put text instructions "Click here to Add Image" in the middle of where I want the image, then I added the Image field with "no fill" on top of that text.  This worked great when I inserted a jpeg file because the image covered up my text.  But then I tried inserting a pdf into this space, and my "Click here" text shows right through. (see image).  How do I make it so that when someone inserts the image, the text disappears? Thank you!

 

text.png

Most Valuable Participant
Correct answer by try67 | Most Valuable Participant

You can change the fill color of the field when it is clicked, like this:

 

event.target.fillColor = color.white;

if (event.target.buttonImportIcon()!=0) event.target.fillColor = color.transparent;

 

The last line of code will change it back to transparent if the user didn't select an image or it failed for some reason.

TOPICS
Create PDFs, How to, PDF forms

Views

44

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
Aug 27, 2020 0
Adobe Community Professional ,
Aug 28, 2020

Copy link to clipboard

Copied

At the image field use a image with the text "Click here to Add Image" .

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
Reply
Loading...
Aug 28, 2020 0
Most Valuable Participant ,
Aug 28, 2020

Copy link to clipboard

Copied

You can change the fill color of the field when it is clicked, like this:

 

event.target.fillColor = color.white;

if (event.target.buttonImportIcon()!=0) event.target.fillColor = color.transparent;

 

The last line of code will change it back to transparent if the user didn't select an image or it failed for some reason.

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
Reply
Loading...
Aug 28, 2020 1
New Here ,
Aug 28, 2020

Copy link to clipboard

Copied

Worked perfectly.  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
Reply
Loading...
Aug 28, 2020 0