-
Notifications
You must be signed in to change notification settings - Fork 37
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
Question: How Create Password Confirm with formz #5
Comments
Hi @guissalustiano 👋 You should probably have two Password inputs one for the original password ( Then in the class ConfirmedPassword extends FormzInput<String, PasswordFieldValidationError> {
const ConfirmedPassword.pure() : original = const Password.pure(), super.pure('');
const ConfirmedPassword.dirty({@required this.original, String value = ''}) : super.dirty(value);
final Password original;
@override
PasswordFieldValidationError validator(String value) {
// you now have access to the original password here via `original`
}
} Hope that helps 👍 |
I am curious to how this would work out if there are 2 inputs that have to be validated against each other. This method won't work anymore since 2 objects cannot co-create each other. @felangel what would be a direction in this case? The example of would be 2 time entries that need to be verified against each other. Like start time and end time. If I add the code example from above the the end_time field then it is only verified against start_time. But start_time is not verified against the initial field and I am struggling to find an elegant solution to solve this. |
Hi @felangel, I'm a little confused when you say you "inject" the original password in the confirmed password class without having to provide it as a parameter in a function etc. Where is the password variable being passed to the confirmPassword class or how is it actually obtaining the original password value. Basically I'm just wondering if you could elaborate on the "inject" part and how the confirmedPassword class actually gains access to the original password value. Thanks Edit: Maybe you could provide a detailed textual representation of exactly whats happing in the .pure() and .dirty() lines. This would be hugely beneficial I think |
It's just injected via constructor when the Hope that helps 👍 |
I'm create a register page and there need has a confirm password field. How is the better aprouch to do this with formz, because validation depends with external value and I don't now the better pattern to use.
I has two inputs
This package did extrymily userfull to help-me separete the logic and view, so I would like understend the better pattern before work around
really thanks!
The text was updated successfully, but these errors were encountered: