Hello ZF,

A team member and I are building a form with a radio element that contains 2
options and a file input element. We need to use the "Extension" validator
but the extension itself is dependent on the radio option that was selected.

We've tried creating a custom validator to use the $context parameter, but
the $context array doesn't contain the value of the radio option. It appears
to contain information about the file upload and not the form values. I'm
aware that the various file validators need this type of info so I know this
isn't a bug.

Is there another way to build a conditional validator for file elements?

One of our quick-and-dirty solutions was to overload this form's isValid()
method and alter the validator before calling parent::isValid, but that
seems more like a hack than a solution. This hacky fix is a concern because
it can bahave differently than the element's own isValid() method.

Any suggestions on how to accomplish this? Thanks!

--
Hector

Reply via email to