Acrobat PDF-Formular - check Checkboxes, set all Fields to unchangeable and send a E-Mail
- December 24, 2020
- 1 reply
- 914 views
Hello,
i am new here. I've searched the forums and Googles and can't find an answer to my problem.
My Document is doing well to this time. But i need some help to complete all routines in the PDF.
i am missing a little addition in the script that will check the eight checkboxes. But the User of the PDF do not need to activate all checkboxes. It will be enough to activate only one of the eight. Only if none of all checkboxes are active some message should appear with a hint to check minimum one of all.
At least i need a code to set all Fields to unchangeable before sending the PDF.
I tried very hard, but i still make no progress.
Do anyone have an idea? It will be great to have some ideas.
Kind regards
dani75.com
Here the current Code:
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("ACHTUNG! Dieses Formular ist nicht vollständig:\nBitte folgendes Feld ergänzen: " + emptyFields.join("\n"));
}else{
sendMail();
}
var sendMail = function(){
var theCompany = this.getField("Feldname1").value;
this.mailDoc({
bUI: false,
cTo: "email@Adress.com",
cSubject: "Text",
cMsg: "Text"});
}
