Created
December 7, 2015 05:51
-
-
Save geekforbrains/f1fe533d9aee37a874a9 to your computer and use it in GitHub Desktop.
PDF Validation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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