Auto Populate TextField When CheckBox is Checked
Copy link to clipboard
Copied
Hello.
I'm needing some help. I have figured out how to auto populate when I check box Same As Legal Address. However, when I do not check the box Same As Legal Address, and I have the Legal Address section filled, and when I go to the Remit Address section, when I type something and click on another text field, it disappears. This is my java script that I'm using in Text 19 in properties
event.value = this.getField("Text12").value;
if (this.getField("SALA").value =="Off")event.value="";
I think my issue is with this part at the end... event.value=""; because when I typed in event.value="Some Value"; it actually put the that in the Text 19.
Any help would be greatly appreciated.
Thank you.
Copy link to clipboard
Copied
Place this script as a Mouse up action in the checkbox:
If (event.target.value != "Off") {
this.getField("Text 19").value = this.getField("Text 12").value;
this.getField("Text 20").value = this.getField("Text 13").value;
this.getField("Text 24").value = this.getField("Text 16").value;
// etc
}
else {
this.getField("Text 19").value = "";
this.getField("Text 20").value = "";
this.getField("Text 24").value = "";
// etc
}
Copy link to clipboard
Copied
Thank JR Boulay. I think I'm missing something. I have put this in the
"SALA" checkbox, Mouse Up, Run Java Script. I getting the following error.
Copy link to clipboard
Copied
I tried this, but getting syntaxerror.
If (event.target.value != "Off") {
this.getField("Text 19").value = this.getField("Text12").value;
this.getField("Text 20").value = this.getField("Text 13").value;
this.getField("Text 24").value = this.getField("Text 16").value;
this.getField("Text 25").value = this.getField("Text 17").value;
this.getField("Text 26").value = this.getField("Text 21").value;
this.getField("Text 27").value = this.getField("Text 22").value;
// etc
}
else {
this.getField("Text 19").value = "";
this.getField("Text 20").value = "";
this.getField("Text 24").value = "";
this.getField("Text 25").value = "";
this.getField("Text 26").value = "";
this.getField("Text 27").value = "";
// etc
}
Copy link to clipboard
Copied
JS is case-sensitive. Use "if", not "If".
Copy link to clipboard
Copied
This worked! Thank you so much!!!
Copy link to clipboard
Copied
Sorry, I misspelled the “if”.

