Hi,
I'm trying to make some text fields mandatory UNLESS the user selects a file in a separate file upload field.
I've used the gform_validation hook to perform custom validation and I've run into a pretty big problem: the value of the file upload field isn't available in my validation function. The file I selected isn't anywhere in the $_POST array. Here's what happens:
- I select a file and click the submit button
- The custom validation kicks in. It can't find the value for the file input field so returns errors.
- I change nothing in the fields and click the submit button again
- Now the field value is ok, the validation checks and I'm allowed to continue
I tried setting the file upload field as "required", just to see what would happen and everything is ok. That is strange to me, as I thought that gform_validation was triggered AFTER the normal validation. So it's weird that the normal validation has access to the field value, but my function doesn't.
Any help would be greatly appreciated...thanks!