blitzar icon indicating copy to clipboard operation
blitzar copied to clipboard

Validations

Open ymarcon opened this issue 3 years ago • 5 comments

While attempting to make a multi-step form (using the showCondition to hide fields that are not part of the current step), I had the issue that "on next step" action, the validateFormPerSchema() call was returning errors from the hidden fields. I could have ignored errors from the fields that are not in the step (extra work), but for the form logic it is still problematic to have errors on fields that cannot be modified.

=> validateFieldPerSchema() does not perform validations on fields for which showCondition is false.

I had also the issue that the error prop is expected to be a Boolean by Quasar's QInput.

=> In validateFieldPerSchema() and in evaluateError(), when error is a Boolean and is false, the error message is looked up in the errorMessage prop (if not found, a default fieldValidationError is shown). When error prop returns a string the original behavior is still operational.

ymarcon avatar Dec 16 '21 21:12 ymarcon

I have updated the PR with the latest production branch.

ymarcon avatar Dec 20 '21 12:12 ymarcon

I have added a fix when checking for Required error on a boolean value.

You can try this PR from my project obiba/quasar-ui-amber, and go to the test page BlitzarFormItemsStepsLayoutTest.vue.

ymarcon avatar Dec 21 '21 08:12 ymarcon

Happy new year, any update about this PR? Validation errors on not visible fields is currently a blocker for me.

ymarcon avatar Jan 05 '22 07:01 ymarcon

@ymarcon happy new year

=> validateFieldPerSchema() does not perform validations on fields for which showCondition is false.

This one I agree with, I want to merge it.

For the rest, in order to decide what to do I think I want to finish the Framework examples for the documentation. I want to experience the exact issue with Quasar to make an informative decision.

when error is a Boolean and is false, the error message is looked up in the errorMessage prop

Do you mean true ?

mesqueeb avatar Jan 05 '22 23:01 mesqueeb

Yes, sorry I meant true.

ymarcon avatar Jan 06 '22 14:01 ymarcon