Problem/Motivation
When testing that, I found that depending on the cardinality, an image/file widget behaves differently when it is hidden.
1 or unlimited: The ManagedFile validation is triggered which doesn't know anything about access or not and then the validation always fails.
Anything else: FileWidget sets its own element validation callback, replacing the default value, which skips the ManagedFile validation but doesn't fail if the field is hidden.
Proposed resolution
Always skip the form-level validation, rely on the constraints? One problem is that we get the usual cryptic validation message then instead of the more readable one.
Comments
Comment #3
aaronbaumanI'm not totally clear on the implications, but this seems like a big change.
Seems like a simpler change would be to always use the same validation scheme - ManagedFile or FileWidget, i'm not sure which - regardless of cardinality.
Am I missing something?
Comment #13
luke.stewart commentedComment #14
luke.stewart commentedThis needs some clearer steps to reproduce.
I just attempted on D12.
Created two fields Type File, File. Cardinality 1 and Cardinality 2. set both to not display on form display (I think this is what you mean by hidden?) but suspect I'm missing something here.
Given this has been sitting with no change since 2019. I think if this doesn't get any update in 3 months it can probably be closed.
Comment #16
luke.stewart commented