Copy link to clipboard
Copied
I am using the script below but it only runs if I check and then uncheck the box. Obviously I want the script to run when I check the box. Also, I want the "Previous Employer Name" field to clear when the box is unchecked.
Any help would be appreciated.
if (event.target.value!="Yes") {
this.getField("Previous Employer Name").value = this.getField("Company NameRow1").valueAsString;
this.getField("Address 1_2").value = this.getField("Company AddressRow1").valueAsString;
}
Copy link to clipboard
Copied
Try this:
if (event.target.value=="Yes") {
Copy link to clipboard
Copied
There is no "obviously" in programming. You have to explicitly layout exactly what you want to happen, and don't want to happen. Computers don't do nuance and innuendo.
For example, I'm assuming that the script you posted is a MouseUp script on the checkbox, but you didn't specify, so I don't really know. If it's not a MouseUp script, then any suggestions I make won't work. You must be explicit about the details.
Here's an updated script that will set and reset the values, if my assumptions are correct.
if (event.target.value!="Off") {
// this code runs when the checkbox is checked
this.getField("Previous Employer Name").value = this.getField("Company NameRow1").valueAsString;
this.getField("Address 1_2").value = this.getField("Company AddressRow1").valueAsString;
}
else{
// This code runs when the checkbox is unchecked
this.getField("Previous Employer Name").value = "";
}
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more