Welcome Dialog

Welcome to the Community!

We have a brand new look! Take a tour with us and explore the latest updates on Adobe Support Community.


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

Participant ,
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

288

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

Adobe Community Professional , Jun 03, 2021 Jun 03, 2021
Use color.transparent

Likes

Translate

Translate
Adobe Community Professional ,
Jun 03, 2021 Jun 03, 2021

Copy link to clipboard

Copied

Use color.transparent

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
Participant ,
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!

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
Community Beginner ,
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? 

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 ,
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.

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