Switch on autovalidation on FormState
See original GitHub issueIn this case autovalidation on FormState
is not working, I mean value => !value.Name.$.trim() && 'Value is required'
is not checking
newTemplate = new FormState({
Name: new InputFieldState<string>('name').validators(value => this.isNameUsed(value) && 'This name is used'),
CampaignType: new DropdownFieldState<CampaignType>(CampaignType.Default)
}).compose().validators(value => !value.Name.$.trim() && 'Value is required');
Validator on FormState
starts autovalidating only if onChange
method of all the FieldState
-s are called and changes theirs values.
this.newTemplate.$.Name.onChange('');
this.newTemplate.$.CampaignType.onChange(CampaignType.IdleAccount);
Can you help me, please?
Issue Analytics
- State:
- Created 4 years ago
- Comments:5
Top Results From Across the Web
allow `FormFieldState` the option to not validate initially when ...
This is a different behaviour than FormState when autoValidate is set to true ... the field will be validated immediately when created and...
Read more >Flutter: Change state depending on validation - Stack Overflow
If autovalidate is turned on, then function passed as validator will be called in FormFieldState.build method to update error text.
Read more >Flutter Forms Validation — the Ultimate Guide - Medium
A form's FormState has two methods, validate() and save() , which open ... Next, turn on autovalidation by adding autovalidate to the Form ......
Read more >useForm - FormState - Simple React forms validation
This object contains information about the entire form state. It helps you to keep on track with the user's interaction with your form...
Read more >React form validation solutions: An ultimate roundup
This roundup is a comprehensive look at some of the most popular solutions for form management and validation in React.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thank you for your excellent reproduction and patience. Sorry for the previous poor design choice on when to fire form validators (
onChangeAfterValidationPass
). Changed to match your (and now mine) intuition (onValidationPass
) 👍1.3.0
🌹formState.enableAutoValidationAndValidate()
will do that 👍