Skip to main content
Participant
August 2, 2023
Question

I would like to change the hightlight/background color of a text box when a checkbox is checked

  • August 2, 2023
  • 0 replies
  • 174 views

I am working on a travel form. I want to highlight the Mileage box yellow when the "Private Auto" checkbox is checked. I have it working where the Mileage box is set to Required and gets a red boarder, but the background color doesn't change from the blue highlight. However, as soon as you click into the Mileage box it turns yellow. My desired result is for the highlight color of the Mileage box to turn yellow as soon as the checkbox is checked. See the attached screen shots.

 

This is the Mouse Up event applied to the Private Auto checkbox:

this.getField("Miles Estimate").required = event.target.value!="Off";

this.getField("Miles Estimate").fillColor = event.target.value != "Off" ? color.yellow:color.white;

 Default State - when Private Auto is not checked.

 

Private Auto is checked. Text box set to Required, gets red boarder, but not highlighted yellow.

 

When the user clicks into the Mileage box it is highlighted yellow.

 

The desired outcome is to have the Mileage box highlight yellow as soon as Private Auto is checked. 

This topic has been closed for replies.