return promise after all fields are validated
See original GitHub issueHello,
I try to realise a form which prevents submitting if validation fails. I have several rules returning promises.
How do I know if validation is completed for all fields using the validateAll
method without validating all fields manually? I have not found any events or callbacks helping me to achieve this behaviour.
Regards, Andreas
Issue Analytics
- State:
- Created 7 years ago
- Comments:13 (10 by maintainers)
Top Results From Across the Web
validate data and then return resolve? - Stack Overflow
If all fields validaton require async operation, you can use Promise.all, which will be resolved only if all the fields validation have been ......
Read more >Promise-Based Validation - Code - Envato Tuts+
Only the operation truly knows when it has completed; as such, it is responsibile for notifying its result using the Promises/A+ contract. In ......
Read more >Using promises - JavaScript - MDN Web Docs
Essentially, a promise is a returned object to which you attach callbacks, instead of passing callbacks into a function. Imagine a function, ...
Read more >promise validator - FormValidation
The promise option must be a function or the name of function which returns a Promise as following: promise: function(input) {. // input.value...
Read more >JavaScript Promises: race, all, allSettled, and then
With promise methods like Promise.all() — which takes an array of promises as an argument a returns a promise that resolves when all...
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
@hootlex yep, now the plugin does not rely on the events to trigger the validations, also
validateAll
will now always return a Promise regardless of what rules were used in the validation, which should make it more predictable/consistent. the same if you are passing values to it it will return also a promise.however it currently does not throw or trigger rejections, which if implemented later will make it more natural to use and very clear, I want to be used like this:
@logaretm great job man! 👌 I have to refactor my projects to take advantage of this asap.