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

External validation errors are not shown instantly #830

Open
jpschober opened this issue Sep 26, 2017 · 5 comments
Open

External validation errors are not shown instantly #830

jpschober opened this issue Sep 26, 2017 · 5 comments

Comments

@jpschober
Copy link

I have the following setup:
paper-form with paper-input elements. The errors property of the paper-input elements is set to model.validations.attrs.[field].messages. Validation is done with ember-cp-validations. This works fine so far with on exception: For one field the validation is done with the ds-error validator to validate error message from the server.

This leads to the following problem:
If I submit the form, the error message gets serialized correctly and even the paper-input method has the error property set BUT it is not shown, as the paper-input element is treated as untouched after submit. I have to first blur on the element to get the error message shown. I would expect this message to be visible instantly.

@backspace
Copy link
Contributor

Would this technique work for your use case, @jpschober?

@panthony
Copy link
Contributor

I believe this is duplicate with #671

The working workaround for me at the moment is to pass isTouched=errors.length.

@jpschober
Copy link
Author

This workaround doesn't work for me and I am wondering it works for you: As ember paper at some point modifies whatever is assigned to isTouched, you get the strange effect that the length property of an array is set to 'true' for example.

@panthony
Copy link
Contributor

@jpschober In my code I do things like:

isTouched=(gt model.errors.property.length 0)

or

isTouched=(readonly isXXXInvalid)

@larryh
Copy link

larryh commented Feb 18, 2018

@panthony Your isTouched=(gt ~~~) solution worked for me - thanks for posting it!

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

4 participants