If I understand correctly, only the fields specified by the validation rule are allowed to be saved. I have 3 form fields, at least one of which must be filled out, and I don’t know how to write the validation rule correctly in JSON so that the user receives a notification both when creating the record and when editing it.
As a test, I tried having all three fields empty, and this validation rule actually works (entered as raw JSON under “Validation”):
{
"_and": [
{ "Kontaktperson": { "_empty": true } },
{ "_and": [] },
{ "Institution": { "_empty": true } },
{ "_and": [] },
{ "Zustaendige_Naturschutzbehoerde": { "_empty": true } }
]
}
The problem arises when I want to specify that at least one of the three fields must be filled in; I thought it would work like this:
{
"_and": [
{ "Kontaktperson": { "_nempty": true } },
{ "_or": [] },
{ "Institution": { "_nempty": true } },
{ "_or": [] },
{ "Zustaendige_Naturschutzbehoerde": { "_nempty": true } }
]
}
… but nothing happens, and the rule doesn’t apply at all.
Or do I need to nest all the cases that should be allowed into multiple OR statements so that they are applied as an AND rule overall? How do I set the rule correctly so that Directus (11.1) checks that at least one of the three fields is filled in?
Thank you very much for any help or advice