VeryGoodOpenSource / formz

A unified form representation in Dart used at Very Good Ventures 🦄

Home Page:https://pub.dev/packages/formz

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Validate form on submit

jasnicaa opened this issue · comments

commented

Hey guys,

Thanks for the awesome package.

I was following the implementation of form validation but I am having a problem trying to fit in clients' requirements: not to validate field until the login button is pressed. After the button is pressed I should show the errorText under the textField. I am using Cubit for that particular screen but so far I was not able to do anything that goes smoothly and without many side effects. Any idea how to achieve it?

Hi @jasnicaa 👋
Thanks for opening an issue!

Have you taken a look at https://github.com/felangel/bloc/tree/master/examples/flutter_form_validation? It should be very similar to what you're trying to achieve. If you're still having trouble can you share a link to a sample app which illustrates the problem you're facing? Thanks! 🙏

commented

Hi, thanks for that input.

I ended up creating multiple statuses with Formz and emitting state for each field and then working with submitting according to that. I am not sure is that a proper or a good way of using this library but it works :)