Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

example/lib/main.dart #95

Closed
andreas1724 opened this issue Jul 14, 2023 · 0 comments · Fixed by #100
Closed

example/lib/main.dart #95

andreas1724 opened this issue Jul 14, 2023 · 0 comments · Fixed by #100
Assignees
Labels
bug Something isn't working as expected documentation Improvements or additions to documentation

Comments

@andreas1724
Copy link

andreas1724 commented Jul 14, 2023

The example formz/example/lib/main.dart, which is also the example on pub.dev/formz, does not seem to behave as expected: If I leave the fields for Email and Password empty, the input in _onSubmit should be rejected, since empty fields do not pass the validator of either Email or Password. However, at program startup or after each _resetForm call, empty text fields are not rejected.

One could solve the problem by changing all default values of the MyFormState constructor from pure to dirty:

MyFormState({
  Email? email,
  this.password = const Password.dirty(),
  this.status = FormzSubmissionStatus.initial,
}) : email = email ?? Email.dirty();

But I am not sure if this is the right approach. Could you please check this?

@wolfenrain wolfenrain self-assigned this Aug 21, 2023
@alestiago alestiago self-assigned this Sep 7, 2023
@alestiago alestiago added documentation Improvements or additions to documentation bug Something isn't working as expected labels Sep 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working as expected documentation Improvements or additions to documentation
Projects
Development

Successfully merging a pull request may close this issue.

3 participants