Changes

Validating File Attributes

1,124 bytes added, 15:58, 11 May 2011
no edit summary
==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)
<pre>
function sbfunc(frm){
var aCV=parseInt("@Applicant CV.numofpages@");
if(aCV<1){
alert("You must upload a PDF of the Applicant CV");
return false;
}if(aCV>10){
alert("The Applicant CV must be less than 10 pages in length.");
return false;
}
</pre>
 
 
The same can be achieved with [[Submit Logic]]
:'''@level1.Applicant CV.numofpages@>0'''
 
 
* The number of files (PDF or otherwise) in a Multiple Files field can be evaluated using '''numoffiles'''.
 
<pre>
function sbfunc(frm){
var supDocs=parseInt("@Supporting Documents.numoffiles@");
if(supDocs>10){
alert("You are not permitted to include more than 10 supporting documents. Please remove at least "+(supDocs-10)+" files");
return false;
}
return true;
}
</pre>
==Number of Pages
==Encrypted==
* If an uploaded PDF file is encrypted it will not be possible to attach it to a [[Web Page View]] using [[ssattach]].
* Attempting to attach an encrypted PDF will not prevent the Web Page View from being converted to PDF. The encrypted file will simply be excluded from the resulting PDF document.
}
</pre>
 
===Multiple Files Custom Field===
::''Pages,Is Encrypted::numofpages,encrypted''
* The multiple file field will then display as follows, and the user can visually ensure the files are not encrypted.
:[[File:MultiPDFencrypted.png]]
0
edits