signauture must not be writable until fields are filled in
Hello everyone, I have the following problem.
The signature field may only be writable when text1 and checkbox1 are filled in. If not, the message should appear which text/boxes are not yet filled in. Only then can the e-signature be set. I have found this code. The message appears, but it can be confirmed with ok and it is still possible to set the signature. In addition, all required fields are queried. However, only text1 and checkbox1 are to be queried as to whether they are filled. Can someone please help me? Thank you very much.
this.getField("Signature").readonly = !validateRequiredFields(this);
function validateRequiredFields(doc) {
var emptyFields = [];
for (var i=0; i<doc.numFields; i++) {
var f = doc.getField(doc.getNthFieldName(i));
if (f!=null && f.type!="button" && f.required && f.valueAsString==f.defaultValue) {
emptyFields.push(f.name);
}
}
if (emptyFields.length>0) {
app.alert("Bitte noch folgende felder ausfüllen:\n" + emptyFields.join("\n"));
return false;
}
return true;
}
