Conditional Formatting and Changing Text Box Colors when values are not equal
Copy link to clipboard
Copied
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!
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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,
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
i keep getting this type error when i enter in the above code - is there a solution to resolve this error?
Copy link to clipboard
Copied
Enter the correct field name as the parameter of gertField. It's not "required".
Copy link to clipboard
Copied
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.

