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

[Question] Validation errors in modal #45

Closed
divdax opened this issue Aug 28, 2019 · 2 comments
Closed

[Question] Validation errors in modal #45

divdax opened this issue Aug 28, 2019 · 2 comments

Comments

@divdax
Copy link

divdax commented Aug 28, 2019

I'm asking how to tackle with modal forms and validation.
Currently there is a FlashMessages Component in the main layout but when you have a modal form the errors are shown in the main layout. How you would tackle this?

Can't get my head around... 🙈

@xalunda
Copy link

xalunda commented Dec 5, 2019

Hi there,

You could use the transformProps method to get your errors into a global data var (or a store).

I'm using this to trigger a sweetalert modal:

transformProps: props => {
  if (props.flash.success) {
    eventBus.$emit('flashMessage', props.flash.success)
  }
  return props
},

When my event is triggered, I init a sweetalert :)

I think you could do the same thing with props.errors.length

Hope this helps

@reinink
Copy link
Member

reinink commented Sep 26, 2020

The trick here is to use error bags which are specific to your form, which we added support for in v0.2.9. 👍

@reinink reinink closed this as completed Sep 26, 2020
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

3 participants