Skip to main content
Participant
April 22, 2025
Answered

If/Then Statements

  • April 22, 2025
  • 2 replies
  • 440 views

I have read the available information for if/then statements, and it seems they are all regarding calculations.. 

I am here to see if there is a way to do "if this checkbox is selected, then allow this text field to be filled out" or even "if this text field has text entered, then allow this text field to be filled out"..

Correct answer JR Boulay

Place this as a mouse up action in the checkbox:

if (event.target.value != "Off") {this.getField("TEXTFIELDNAME").readonly = false;}
else {
this.getField("TEXTFIELDNAME").readonly = true;
this.getField("TEXTFIELDNAME").value = this.getField("TEXTFIELDNAME").defaultValue;
}

2 replies

Pariah Burke
Community Expert
Community Expert
April 22, 2025

JR Boulay beat me to the answer by 20 seconds. 🙂

 

 

JR Boulay
Community Expert
JR BoulayCommunity ExpertCorrect answer
Community Expert
April 22, 2025

Place this as a mouse up action in the checkbox:

if (event.target.value != "Off") {this.getField("TEXTFIELDNAME").readonly = false;}
else {
this.getField("TEXTFIELDNAME").readonly = true;
this.getField("TEXTFIELDNAME").value = this.getField("TEXTFIELDNAME").defaultValue;
}
Acrobate du PDF, InDesigner et Photoshopographe