Skip to main content
elmo_choi
Participant
May 16, 2018
Question

What is the JavaScript for turning off the "Highlight Colour" on a text box once you have filled it in - Adobe Form?

  • May 16, 2018
  • 1 reply
  • 1020 views

Hi there,

I am wondering what the JavaScript for turning off the "Highlight Colour" on a text box once you have filled it in - Adobe Form - is ?

I would like to add it as a "Mouse Exit" - action.

Thank you in advance!

This topic has been closed for replies.

1 reply

Participating Frequently
May 16, 2018

You'll first need to disable the normal runtime highlight in a document level script using...

app.runtimeHighlight = false;

Then in the format script of each field, add the following...

var field = event.target;

if (field.value == field.defaultValue) {

     field.fillColor = color.cyan; // for example

}

else {

     field.fillColor = color.transparent;

}

The format script runs last so that's the place to put the code. In this case, you're formatting the appearance of the field rather than formatting the value though.

elmo_choi
elmo_choiAuthor
Participant
May 17, 2018

Hi Joel,

Thanks a lot for your help. This solved the problem. However, I did read somewhere that if you add the normal app runtime highlight to the document, it affects all of your other documents, as well as all the documents for the person who receives the form. Is there a way to not have this happen, or undo the script after if needed? I tried deleting the script to see if it would undo it, but it didn't. It still keeps the transparent highlight.

Thank you!

Participating Frequently
May 17, 2018

You are correct. Turning off the highlight via scripting does (though at one time it didn't, and really shouldn't) change the user preference.

You can set the property back to true in the document WillClose action. That should allow other documents to act normally.