We have a Safecracker form where we allow people to post a couple things (PDF, JPG) via Safecracker File fields. I’m adding a number of rules to my SC form, per these instructions: CodeIgniter Form Validation Rule Reference. Here are my rules:
rules:description="required"
rules:email="required|valid_email"
rules:first_name="required"
rules:last_name="required"
rules:pdf_attachment="required"
rules:screenshot="required"PDF Attachment and Screenshot are SC File fields. When I submit the form without filling anything out (and with no JS validation), I get all the errors I’d expect:
The form you submitted contained the following errors
- The Description field is required.
- The Your Email field is required.
- The First Name field is required.
- The Last Name field is required.
- The Title field is required.
There is never anything about the file fields being required. Is it possible to at least make sure something has been entered in that field? If a user disables JS they would be able to submit this form without uploading a single file. I don’t know how else to validate a file upload with this fieldtype on the server side.
EDIT: This is related to this thread: http://ellislab.com/forums/viewthread/202377/ and a bug report is already in: https://support.ellislab.com/bugs/detail/16798 (as of this writing the bug is over 2 months old and hasn’t been assigned to anyone)