Replies: 2 comments
-
Hi @tvidenov, we are not likely to provide any kind of first-class support for "form validation" in the library. That topic is too wide and varied for the library to have an opinion. Some people like to do it client side, some people like to send all data to the server and let it handle validation, and some do a mixture of both. We don't think TCA needs to wade into those waters, and instead it concentrates on being a very light layer on top of SwiftUI/UIKit. But, if you just want to generally ask other people how they handle validation in their features, then perhaps you can provide an example of the kind of validation you are talking about. A standalone, functional project would help people see what problems you are trying to deal with and provide feedback. It can be built in vanilla SwiftUI, TCA, or whatever form you feel best shows the problems. |
Beta Was this translation helpful? Give feedback.
-
Hi @tvidenov, I just replied to that older thread with what I came up with to handle per-field validation logic as well as handle some other common requirements (like validating on an attempt to submit the form). My comment is here: #793 (comment) I didn't touch something like keyboard navigation or focus, but while my approach has some wrinkles, I think it's adaptable enough to fit most cases, even if it's not a drop-in solution. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I've searched a lot for any examples but didn't got much so far. How would you approach a complex screen where you have a few fields with different data types ( ex. a number field, a text field, a picker field, etc ) while each field has some custom validation and sanitanization logic in order to collect the correct input and enable it to be submitted? The cherry on top would be to support keyboard navigation ( eg. next, back button ) in order to go to next or previous field.
I've seen some discussions about a @Validate wrapper ( here ) but nothing came out of it. I feel this is a very popular case and would be awesome if we have some more complex example for it.
Beta Was this translation helpful? Give feedback.
All reactions