stefangabos / Zebra_Form

A jQuery augmented PHP library for creating secure HTML forms and validating them easily
Other
98 stars 49 forks source link

a file upload with a dependency on a checkbox value, fails #43

Open njwgh opened 3 years ago

njwgh commented 3 years ago

There is an error in zebra_form.php in the _validate_dependencies function

This line: if ($control_properties->attributes['name'] == $proxy && ($control_properties->attributes['type'] == 'radio' || $control_properties->attributes['name'] == 'checkbox')) {

should be

if ($control_properties->attributes['name'] == $proxy && ($control_properties->attributes['type'] == 'radio' || $control_properties->attributes['type'] == 'checkbox')) {

With the code as it is, if you have a file upload field that depends on a checkbox being checked, then the file you choose will not be uploaded.

I have confirmed that with my suggested correction, that the file upload will then work correctly