Skip to content

Instantly share code, notes, and snippets.

@geekforbrains
Created December 7, 2015 05:51
Show Gist options
  • Save geekforbrains/f1fe533d9aee37a874a9 to your computer and use it in GitHub Desktop.
Save geekforbrains/f1fe533d9aee37a874a9 to your computer and use it in GitHub Desktop.
PDF Validation
function validateForm() {
var fields = [
'date_Inspection Date',
'txt_Serial Number',
// Add more fields here
];
for(var i = 0; i < fields.length; i++) {
var field = fields[i];
var value = this.getField(field).value.trim();
if(value == '') {
var bits = field.split('_');
alert(bits[0] + ' is required');
return false;
}
}
return true;
}
if(validateForm()) {
this.mailDoc({
bUI: true,
cTo: "craig.vickery@hvac-solutions.ca",
cCc: "",
cSubject: "Checksheet - " +
this.getField("date_Inspection Date").value +
" - WO: " + this.getField("txt_Work Order").value +
", Serial: " +
this.getField("txt_Serial Number").value,
cMsg: "Body"
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment