Sorry but I am a little lost on this. Here is what I have setup so far in my Notepad. Where would I add the part about the save as? Sorry I am a graphic designer and not a programmer.
var emptyFields = [];
for (var i=0; i<this.numFields; i++) {
var f= this.getField(this.getNthFieldName(i));
if (f.type!="button" && f.required ) {
if ((f.type=="text" && f.value=="") || (f.type=="checkbox" && f.value=="Off")) emptyFields.push(f.name);
}
}
if (emptyFields.length>0) {
app.alert("Error! You must fill in the following fields:\n" + emptyFields.join("\n"));
}
var parts = getField("Job Name").value
var kind = getField("Today's Date").value
var date = getField("Holiday").value
this.mailDoc({
cTo: "Becky.Tonn@bicgraphic.com",
cSubject: parts + " - " + kind + " - " + date,
cMsg: "A new request has been sent from sales."
});
Use this code:
var emptyFields = [];
for (var i=0; i<this.numFields; i++) {
var f= this.getField(this.getNthFieldName(i));
if (f.type!="button" && f.required && f.valueAsString==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 {
app.execMenuItem("SaveAs");
var parts = this.getField("Job Name").valueAsString;
var kind = this.getField("Today's Date").valueAsString;
var date = this.getField("Holiday").valueAsString;
this.mailDoc({
cTo: "Becky.Tonn@bicgraphic.com",
cSubject: parts + " - " + kind + " - " + date,
cMsg: "A new request has been sent from sales."
});
}