Javascript在杂技形式设置目标电子邮件地址



我正在尝试使用这个。getField代码读取表单并设置目标电子邮件地址。你知道我做错了什么吗?表单字段是Type、PersonName、PersonStaffNumber和SessionNo。它们都是文本字段,除了PersonStaffNumber,它是一个小数到零的数字。

var sendForm = app.alert("Confirm you are you ready to submit the form?",2,2,"Submit Validation");
var message1 = "A form has been submitted. See attached.";
var cToAddr = "me@company.com";
var typeAC = this.getField("Type").value;
var candName = this.getField("PersonName").value;
var candNumber = this.getField("PersonStaffNumber").value;
var session = this.getField("SessionNo").value;
var cSubline = "Form submission " + candName;
if(sendForm == 4) {
if (typeAC === "B757") {
cToAddr = "757@company.com";
}
else if (typeAC === "B767") {
cToAddr = "767@company.com";
}
else if (typeAC === "A330") {
cToAddr = "330@company.com";
}
else (typeAC === "A380") {
cToAddr = "380@company.com";
}
this.mailDoc({bUI: true, cTo: cToAddr, cSubject: cSubline, cMsg: message1});
}
else
app.alert("Please continue with the form");

当超过第一个弹出警告和"是"时,脚本似乎不运行;选中。

这里有几个问题。在else后面不能有任何东西,而且还少了括号。更正后的代码如下:

var sendForm = app.alert("Confirm you are you ready to submit the form?", 2, 2, "Submit Validation");
var message1 = "A form has been submitted. See attached.";
var cToAddr = "me@company.com";
var typeAC = this.getField("Type").value;
var candName = this.getField("PersonName").value;
var candNumber = this.getField("PersonStaffNumber").value;
var session = this.getField("SessionNo").value;
var cSubline = "Form submission " + candName;
if (sendForm == 4) {
if (typeAC === "B757") {
cToAddr = "757@company.com";
}
else if (typeAC === "B767") {
cToAddr = "767@company.com";
}
else if (typeAC === "A330") {
cToAddr = "330@company.com";
}
else if (typeAC === "A380") {
cToAddr = "380@company.com";
}
this.mailDoc({ bUI: true, cTo: cToAddr, cSubject: cSubline, cMsg: message1 });
}
else {
app.alert("Please continue with the form");
}

最新更新