Required fields in conditional logic Payload 2 #8662
Unanswered
sandstone991
asked this question in
Q&A
Replies: 2 comments 5 replies
-
Hmm, this is a good question. In my eyes the correct solution here is to add a custom validate function to each. The idea is that you would check your condition, and if the type does not match you would return false. |
Beta Was this translation helpful? Give feedback.
5 replies
-
Hi @akhrarovsaid, Thanks for your reply. I feel like "required" should be able to take a function so as not to lose the UI associated with the required element. But yes, using a custom validate function will work as expected. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Suppose I have a fields schema like this
Expected behavior for me:
When choosing cat through the select input, the dogName field is not required and doesn't give an error when validating.
Actual behavior:
The document doesn't get saved because it tells me that the dogName field is required.
If anyone can give me their thoughts on this I'd very grateful.
thank you.
Beta Was this translation helpful? Give feedback.
All reactions