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

Empty fields given a yellow background color, need to be transparent when filled

Contributor ,
Jun 03, 2021 Jun 03, 2021

Copy link to clipboard

Copied

I have successfully figured out how to add a yellow background color to a field if it is empty (to alert a user to fill it out), but I cannot figure out how to get it back to transparent when the field is filled. I was able to figure how to get it be a white background, but that's not a solution as the background overlaps the lines of the form and looks odd. Normal backgrounds are transparent. I just want it to go back to "normal" when a user fills it out. I tried "color:none", but that doesn't seem to be a valid value?

 

// If field is blank, yellow background
if (!event.value) {
event.target.fillColor = color.yellow;
} else {
if (event.value) {
event.target.fillColor = color.white;
}
}

 

TOPICS
PDF forms

Views

1.6K

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 , Jun 03, 2021 Jun 03, 2021

Use color.transparent

Votes

Translate

Translate
Community Expert ,
Jun 03, 2021 Jun 03, 2021

Copy link to clipboard

Copied

Use color.transparent

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
Contributor ,
Jun 03, 2021 Jun 03, 2021

Copy link to clipboard

Copied

Oh. LOL. Thank you, Nesa. I didn't consider "transparent". I use "none" a lot in CSS so I assumed that was the code. THANK YOU!

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
Explorer ,
Aug 08, 2021 Aug 08, 2021

Copy link to clipboard

Copied

When using this formula, the field only changes to yellow when I tab into the field, and changes back to transparent after tabbing out without entering any data.  Is it possible to have the field (several on a document) background default as yellow when viewing, and then change to transparent as data is entered in those fields? 

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 09, 2021 Aug 09, 2021

Copy link to clipboard

Copied

LATEST

Where did you put script?

Use it as validation script.For the first time you will need to enter data in field and then delete for code to kick in or set it to yellow manually for the first time.

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