We have a brand new look! Take a tour with us and explore the latest updates on Adobe Support Community.
HI! I want to learn how I can change the color of a text field based on specific selections from a drop down menu. If let's say "Medicaid" is selected from drop down menu field "Insurance Company Name", I would like the text field "Medicaid" to highlight yellow. How can I do that with java script? Thanks!
As the custom calculation script of text field enter the following code:
event.target.fillColor = (this.getField("Insurance Company Name").valueAsString=="Medicaid") ? color.yellow : color.transparent;
You rock! That worked! I have multiple selections that if selected from the drop down I want to change the textfield to yellow. Where would I enter the other selections in your script?
You can do it like this:
var v = this.getField("Insurance Company Name").valueAsString;
event.target.fillColor = (v=="Medicaid" || v=="Something else" || v=="Yet another thing") ? color.yellow : color.transparent;
Thank you soooooo much! That worked perfectly!
Hi, I have another question
What should I write if I want to create different colors for different dropdown options?
Many thanks 🙂
What should I write if I want to create different colors for different text options?
Can someone please help me? I have a dropdown menu in PDF forms in which there are 2 options (text) and I want based on the option that someone chooses the text colour to change. How can I code this in java?