question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Several mods of validation for the same form

See original GitHub issue

Is your feature request related to a problem? Please describe. From requirements perspective I need to have two fields to be validated using onChange approach and the other one is onBlur.

Describe the solution you’d like Give possibility to override default form Mode. For example

type FormType = {
  firstName: string;
  secondName: string;
  age: number;
}

const form = useForm<FormType>({
  mode: 'onChange',
  fieldOptions: { firstName: { mode: 'onBlur' } },
});

Describe alternatives you’ve considered As alternative I tried to use onBlur prop, checking manually against desired requirement (in my case it’s a regexp). And then manually setting error. But it feels a bit cumbersome, because now I have validation in several places.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
s5unanowcommented, Jul 12, 2022

Nevertheless I totally understand your desire to keep api as simple as possible. So I am ok with current solution and enjoying using library ❤️. Just thought it would be not that hard to add functionality I’ve suggested.

I guess we might close now.

0reactions
bluebill1049commented, Jul 12, 2022

thanks for understanding 🙏 @s5unanow I will close the issue until more users report for such API to be reconsidered.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How To Create A Multiple Data Validation In The Same Cells ...
In this video we'll learn how to incorporate multiple criteria into the same cells to prohibit invalid entries when using Data Valdiation.
Read more >
Blazor: validating multiple forms with the same model
Unfortunately, when the first form is displayed and submitted, the missing field is validated, and the validation fails. Is there any way to...
Read more >
Moodle in English: Custom Form validation Function...How?
Hello, i have developed a own "add Resource"-Functionality but now i need to validate one Field on the Serverside by a custom Function....
Read more >
Design Principles for Enhancements to MODS and MADS
Goals to guide the enhancement of MODS and MADS ; 5. Support validation of the encoding. 1) Adopt widely used and supported validation...
Read more >
Validate function in Power Apps - Microsoft Learn
The Validate function checks whether the value of a single column or a complete record is valid for a data source. Description. Before...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found