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

Form validation #282

Open
KKranjcevic opened this issue Mar 21, 2023 · 0 comments
Open

Form validation #282

KKranjcevic opened this issue Mar 21, 2023 · 0 comments

Comments

@KKranjcevic
Copy link

If you have a text field in a form that depends on another text field, the validation doesn't work. I have a form called Reset Password with two fields: New Password and Repeat Password. The Repeat Password validation depends on the New Password text.
It works fine if I set a new password and then repeat password, but if I return to the New Password field and want to change it, the Repeat Password will show an error(this is ok, because the password do not match enymore) .
If I set the New Password to match the Repeat Password field again, the Repeat Password will not go through its validation because now it has an error, and the state has not changed. Despite the fields matching, the Repeat Password field still has an error until you change it.

The problem is in the i_base_form_field.dart file:

///Validate the input text by invoking its validator.
bool validate([bool isFromSubmission = false]) {
if (!isFromSubmission &&
_inj.hasError &&
_inj.oldSnapState?.data == _inj.snapValue.data) {
return false;
}
....

The if statement should be removed because it disables the validation check even though it should be performed. Alternatively, the validation should be changed to add an optional parameter that forces the validation, one that sets isFromSubmission to true.

This problem does not occur in version 5.2."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant