Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ValidationErrors initially not rendered into ErrorHandler components #70

Open
Fuasmattn opened this issue Aug 13, 2020 · 3 comments
Open

Comments

@Fuasmattn
Copy link

We defined some Validation Error Boxes that are filled with the correct vfjsErrors message whenever there is a validation error. However, injecting the message does not work initially, saying when the form is rendered with some falsy model. For example a missing property that is required or any other constellation that causes validation errors.

The vfjsState includes the expected errors, also with the messages that should be rendered.
We solved this for now with the following workaround:

<template>
  <vue-form-json-schema :options="options" />
</template>
private options = {
    castToSchemaType: true,
    showValidationErrors: false,
    validateOnLoad: true,
}

private mounted () {
  this.initializeOptions();
}

private initializeOptions () {
  this.options = { ...this.options, showValidationErrors: true };
}

This is working, but it has a high potential not to be understood without comment as it is not intuitive.

Are you aware of this as a bug or are we missing something here?

@jarvelov
Copy link
Owner

Hi!

Thank you for reporting this issue! This is definitely a bug as the form should be able to be initialized in an error state. I've been able to replicate this here

I'll troubleshoot this today and see if I can find a solution.

@jarvelov
Copy link
Owner

I just published v2.8.2 which patches this issue. You can see that this issue is fixed in this demo. Please let me know if you're still experiencing issues after upgrading.

@Fuasmattn
Copy link
Author

Hi! Thanks a lot for that really quick fix! The Demo looks good, just tested the new version in our project and it's working as expected 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants