Quantcast
Channel: Adobe Community: Message List
Viewing all articles
Browse latest Browse all 97529

Re: submit form javascript required fields

$
0
0

Sorry I missed the link the first time I read the post.

 

I still need to adapt the script from that post for my form but how should I add it to the current script I have written to attach it to the mail etc.

 

If I do it as shown below then I get a syntax error at line 14 where I have else this.mailDoc({

 

var parts = "Request - "+getField("Component").value+" - "+getField("Serial_Number").value+" - "+getField("rep_Number").value

var cBody = getField("Diagnostic").value

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"));

}

}

else this.mailDoc({

cTo: "tim@tim.com",

cCc: "tim@tim.com",

cSubject: parts,

cMsg: cBody

});


Viewing all articles
Browse latest Browse all 97529

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>