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

Conditional Formatting and Changing Text Box Colors when values are not equal

Community Beginner ,
May 24, 2022 May 24, 2022

Hello,

 

I am trying to conditional format in my form on Adobe acrobat Pro DC. What im trying to acheive is to have the text box in the field "Actual" to change to the color red when it does not match the value listed in the "required" field. I have been looking online, but have not found anything for when the values are not equal. Could someone please provide me a javascript code?

 

Thank-you for the help in advance!

 

 

Emilie245852625jf0_0-1653410942003.pngexpand image

 

TOPICS
Edit and convert PDFs , General troubleshooting , How to , JavaScript , PDF forms
2.3K
Translate
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 Employee ,
May 24, 2022 May 24, 2022

Hi there

 

Hope you are doing well and sorry for the trouble.

 

The workflow you are trying to achieve is possible using the JavaScript.  For more information about using JavaScript, please check the help pages listed below:

https://helpx.adobe.com/acrobat/using/applying-actions-scripts-pdfs.html

https://acrobatusers.com/tutorials/javascript_console/

 

Hope this information will help

 

Regards

Amal

Translate
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 ,
May 24, 2022 May 24, 2022

Good Day Amal, 

 

I am aware that i need to use Java script as previously stated in my question - what im asking for is the proper formula/code to input into the java script.

 

Thankyou,

Translate
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 ,
May 24, 2022 May 24, 2022

Not equal in javascript is != you can use it like this:

if(event.value != this.getField("required").value)

event.target.fillColor = color.red;

You need to turn off field highlight or you won't be able to see colors.

Translate
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 ,
May 24, 2022 May 24, 2022

i keep getting this type error when i enter in the above code - is there a solution to resolve this error?

 

Emilie245852625jf0_0-1653424040653.pngexpand image

 

Translate
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 ,
May 24, 2022 May 24, 2022

Enter the correct field name as the parameter of gertField. It's not "required".

Translate
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 ,
May 24, 2022 May 24, 2022
LATEST

As try67 mentioned, you need to use your actual field name, my script was just example since you didn't provide any field names. If you need this to happen for every field in column instead of using script in every field you can use script with loop in one of the fields which will work for all fields, but to help you with that we would need to know your field names or share actual file with us.

Translate
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