Use this code, and remove any other command you have under that button:
var nButton = app.alert("Are you sure you want to submit the Staging Pre-Configuration Request? After submission the form won't be editable.", 1, 2);
var emptyFields = [];
if (nButton == 4) {
var aExcept = ["Stag_Comm", "Ret_Date_af_date", "Sta_Name", "Sta_Sign", "Sta_submit", "Remove Page", "Add Page", "Pic_1_af_image", "Pic_2_af_image", "Remove Page Template", "Add Page Template", "Pic_1 Template_af_image", "Pic_2 Template_af_image"];
for (var i = 0; i < this.numFields; i++) {
var name = this.getNthFieldName(i);{
if (aExcept.indexOf(name) == -1) {
var f = this.getField(name);
if (f.type != "button" && f.required && f.value == f.defaultValue) {
emptyFields.push(f.name);
}
}
}
}
if (emptyFields.length > 0) {
app.alert("Error! You must fill in the following fields:\n" + emptyFields.join("\n"));
} else {
for (var i = 0; i < this.numFields; i++) {
var name = this.getNthFieldName(i);
var f = this.getField(name);
if (f != null) f.readonly = true;
}
this.getField("Req_submit").display = display.hidden;
this.mailDoc({cTo: "me@email.com"});
}
}
... View more