Replies: 1 comment
-
Just distinct form completion from form validation. |
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
-
I have a simple form to "add/edit" an entity. My (simplified)
zod
schema looks like this:The default values for the "add" use case look like this:
These are my requirements for the
port
field:port
fieldSo for the "add" use case most of the form fields should be empty (except the
host
field), only when i edit i want to set the current values for that entity as the default values.The problem is, that
zod
won't allow this, as i must set a default value for theport
field as it is a required field. From an UX perspective this isn't optimal, as i want to leave theport
field empty and force the user to enter a value.The only way i've found so far is to set the
port
field to0
. But for the reason above this is not a good solution.I wonder if there are other solutions to this problem? It seems like this shouldn't be rare case, as it is usually a requirement to pre-fill some fields, while other's must explicitly filled out by the user.
Beta Was this translation helpful? Give feedback.
All reactions