quasar icon indicating copy to clipboard operation
quasar copied to clipboard

QForm validate bug (or possibly new feature?)

Open Lukino2000 opened this issue 7 years ago • 5 comments

Hi all, I need to show my users an empty form but with error on every non validated field, some kind of pre flight-validation. I found the validate method on QForm that probably can help me,but i notice it exits after showing first not validated field skipping all remaining fields.

as an example you can see Here the QForm validation Here what i need, with a custom function

the question/request is: is it right that validate function exits after first error or it should show/validate all other fields?

Lukino2000 avatar May 12 '19 13:05 Lukino2000

Hi,

This is for a) performance reasons and b) to make it as generic as possible because you could use async rules on a lot of QForm containing components which would make validation take "too long".

rstoenescu avatar May 13 '19 12:05 rstoenescu

I think having at least the option to do a "deep" validation would be helpful. It helps me make sure that the form and the labels are in sync (plus easier integration testing). In addition, this is an easy way to highlight all required/improper fields for the user. Not sure what it would take to do this, but would you consider a PR that did this? Thanks.

rettigd avatar May 26 '19 00:05 rettigd

This feels so weird, I would definitely opt for a "deep validation". From UX perspective, imagine a long form with lots of optional inputs but still few (hard to spot) required ones. It's usually much easier to fill in what you as user consider required and then let the submit button highlight all errors for you to fix contrary to be forced to press submit after each fix just move to next one (and damn if the form is long and submit at the bottom)...

@rstoenescu Reopen and maybe consider that PR from @rettigd, please?

smajl avatar Jul 09 '19 15:07 smajl

@smajl I will consider it.

rstoenescu avatar Jul 09 '19 20:07 rstoenescu

"Greedy" validation (as requested) will be available in v1.1.1 through the greedy prop.

rstoenescu avatar Sep 05 '19 11:09 rstoenescu