Custom image fields: show-if prevents value save, required-if not working
Short description of the issue
There are issues when using show-if and required-if settings for custom image fields.
In the example below the text_2 field has a show-if condition text_1!=''. This prevents any value from being saved to the text_2 field.
If I remove the show-if condition and add a required-if condition text_1!='' then this condition isn't enforced and no error message is shown when text_1 is populated and text_2 is left empty.
Setup/Environment
- ProcessWire version: 3.0.236
As far as I know/remember, we have not specifically built support for field dependencies in custom image fields. This is the sort of thing that might take a lot of work to support support, or not. I'm not really certain without diving in. I'll keep this in the queue as a requested feature.
@ryancramerdesign, perhaps useDependencies could be set to false for the custom fields InputfieldWrapper?
Maybe adding the line below here
$inputfields->useDependencies = false;
Then showIf conditions would work via the JS side only. They wouldn't get the extra validation on the PHP side but at least the field value would save, so still an improvement.
It would need a different solution to get requiredIf working, but that could come later. I proposed a possible solution for requiredIf in repeater items here, and perhaps something similar would work for image/file custom fields?