Skip to main content
Known Participant
June 19, 2020
Question

Changing colour and locking text fields by clicking check box

  • June 19, 2020
  • 1 reply
  • 1939 views

Hi all

 

In interactive pdf forms is it possible to fill color in individual text fields basis certain criteria.  For example i have a text field which automatically fills a number basis conditions in a checkbox.

now i want this field to change colour also at the same time.  For better understanding please see below:

 

Text field - Score1

check box1

 

 

for now i have set the below script to get the desired value in Text field Score1 when the check box is clicked

 

if (event.target.value != "Off") {
this.getField("Score1").value = "60" ;
} else {
this.getField("Score1").value = "50" ;

now I want the text field to change colour to Red if i get 50 and to green if i get 60

please note that it is important that Text field Score1 is made non editable and change in colour stays permanent.

thanks for your help 

 

This topic has been closed for replies.

1 reply

JR Boulay
Adobe Expert
June 19, 2020
if (event.target.value != "Off") {
this.getField("Score1").value = "60" ;
this.getField("Score1").fillColor = color.green; } else { this.getField("Score1").value = "50" ;
this.getField("Score1").fillColor = color.red;
}
Acrobate du PDF, InDesigner et Photoshopographe
NKB0609Author
Known Participant
June 19, 2020

Thanks a lot for your response, much appreciate.  I have tried this code but the challenge is that if i click on the text box (Score1) color changes as scripted however if I click anywhere else, colour disappears.  Also is there a way to make this text box uneditable as i do not want the user to change the values.  Thanks for all your help. 

Bernd Alheit
Adobe Expert
June 20, 2020

Set the text field as read-only.