-
Notifications
You must be signed in to change notification settings - Fork 0
Require this field OR that field #595
Comments
You possible mean |
Hello @afbora , I don't see how the when -> then feature could be used to do what I mean here. What I mean is to extend the actual 'require' field option in a way that allows to require any field among a number of fields. For example among field A, B and C, the user needs to fill at least one, any of them. The user can fill two or three, but only one (any) is 'required'. Is that clear? Thanks |
With when:
- test:
otherField: ''
anotherField: ''
comparison: and
then:
required: true
otherwise:
required: false |
Yes, that does seem a way to accomplish the same, although quite verbose considering all that code would need to go on the three fields in your example. Is that final syntax? I would still prefer a simpler syntax such as
...which would be more close to what we already do, and specific to Cheers! |
I agree that the syntax is more verbose, but it's also a lot more flexible. The point is: If we can implement one feature that covers many use-cases, that's a lot better than individual features that make both the blueprint syntax and the implementation way more complex. Also we would duplicate functionality, which will create edge-cases that don't work as expected.
No, it's the current state of the discussion. |
The idea would be to be able to require a field OR another field. One or the other, not necessarily both.
For example, on the following blueprint I need either a cover image to be provided, or at least one image on the images section, but not both.
The syntax could be something like:
...this particular example mixes 'required' and 'min', but the idea is the same.
The text was updated successfully, but these errors were encountered: