• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Creating a disappearing Add Image Button

New Here ,
Aug 27, 2020 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

TOPICS
Create PDFs , How to , PDF forms

Views

512

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 1 Correct answer

Community Expert , Aug 28, 2020 Aug 28, 2020

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.

Votes

Translate

Translate
Community Expert ,
Aug 28, 2020 Aug 28, 2020

Copy link to clipboard

Copied

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

Votes

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
Community Expert ,
Aug 28, 2020 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.

Votes

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 ,
Sep 09, 2024 Sep 09, 2024

Copy link to clipboard

Copied

What if the background colour is a specific RGB off white, how would you set the fillColour value?

 

Votes

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
Community Expert ,
Sep 09, 2024 Sep 09, 2024

Copy link to clipboard

Copied

LATEST

You can specify a specific RGB value like this:

event.target.fillColor = ["RGB", 0.25, 0.9, 1];

Notice the values are between 0 and 1, not 0 and 255, as in other places.

To convert the latter to the former just divide your values by 255.

Votes

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 ,
Aug 28, 2020 Aug 28, 2020

Copy link to clipboard

Copied

Worked perfectly.  Thanks!

Votes

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