JavaScript not saving
So, I keep putting this script into a checkbox:
var checkbox = this.getField("Check Enclosed");
var fields = ["Signature", "Billing Address", "Name on Card", "CVV", "Exp Date", "Name", "Card"];
function setRequiredFields() {
for (var i = 0; i < fields.length; i++) {
var field = this.getField(fields[i]);
field.required = checkbox.value === "Off";
}
}
checkbox.setAction("MouseUp", "setRequiredFields();");
setRequiredFields();
And it works fine, but when I save and open the document again it replaces the script with just
setRequiredFields();
Anyone know why this might be happening?
