Changes

Validating File Attributes

463 bytes added, 15:47, 6 April 2017
Multiple Files Custom Field
 
 
 
==Number of Pages==
* The number of pages that a PDF file in a [[Single File]] field contains can be evaluated as follows
* This script will prevent saving or submitting a record unless there is a valid PDF stored in the '''Applicant CV''' single file field, and it must be 10 or less pages in length. ([[sbfunc]] is not run on Save Draft, so the record can be saved with Save Draft, if available)
<prestyle="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">
function sbfunc(frm){
var aCV=parseInt("@Applicant CV.numofpages@");
* The number of files (PDF or otherwise) in a Multiple Files field can be evaluated using '''numoffiles'''.
<prestyle="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">
function sbfunc(frm){
var supDocs=parseInt("@Supporting Documents.numoffiles@");
<prestyle="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">
function onloadfunc(){
if("@Applicant CV.[encrypted]@"=="YesEncrypted")
alert("The PDF version of the applicant CV is encrypted and cannot be attached to the application. The file must be replaced with a PDF that does not have the 'Content Copying' restriction in place.");
}
* The multiple file field will then display as follows, and the user can visually ensure the files are not encrypted.
:[[File:MultiPDFencryptedMultiPDFsencrypted.png]]  
==See Also==
* [[Display Additional File Attributes for PDF Documents]]
[[Category:PDF]][[Category:JavaScript]][[Category:Files]][[Category:Validation]]
Smartstaff, administrator
4,478
edits