Hi! Given the recent discussions on conditional validations (aka Refine) in the repo, I would like to share my use-case to expose one more need that is highly related and that I think would be a great addition to fully exploit their potential:
Context
I use typebox to do form validation using shadcn/ui + react-hook-form and I have been many times in the situation where I need to:
- Do conditional validation of complex schemas where the accepted values of one field(s) depend on another field(s)
- Give feedback to the user on why the form didn't pass the validation
- Give feedback to the user on which part of the form didn't pass the validation
How far can I get with typebox?
I have tried implementations with this Refine type and Unions and I am able to meet requirement 1, but not 2 and 3.
Both threads discuss about errors being too generic and provide a workaround that works for requirement 2 using SetErrorFunction, but still doesn't cover 3.
Trying to be more concrete: I need to not only customize the error message, but also the path to which the error is related. This would allow me to highlight the specific form fields in the UI to catch the user's attention. In fact, shadcn/ui already does it but depends on the path.
Based on what I have read in the repository I understand that this feature might not be considered soon, but if someday you think about Refine again (or any other more complex validation strategy), I hope you can consider this :)
Hi! Given the recent discussions on conditional validations (aka Refine) in the repo, I would like to share my use-case to expose one more need that is highly related and that I think would be a great addition to fully exploit their potential:
Context
I use
typeboxto do form validation using shadcn/ui + react-hook-form and I have been many times in the situation where I need to:How far can I get with typebox?
I have tried implementations with this Refine type and Unions and I am able to meet requirement 1, but not 2 and 3.
Both threads discuss about errors being too generic and provide a workaround that works for requirement 2 using
SetErrorFunction, but still doesn't cover 3.Trying to be more concrete: I need to not only customize the error message, but also the path to which the error is related. This would allow me to highlight the specific form fields in the UI to catch the user's attention. In fact,
shadcn/uialready does it but depends on the path.Based on what I have read in the repository I understand that this feature might not be considered soon, but if someday you think about Refine again (or any other more complex validation strategy), I hope you can consider this :)