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

Clear error messages #81

Closed
2 tasks done
offirgolan opened this issue Nov 20, 2015 · 3 comments
Closed
2 tasks done

Clear error messages #81

offirgolan opened this issue Nov 20, 2015 · 3 comments

Comments

@offirgolan
Copy link
Collaborator

In reference to #80

There should be a way to clear errors with the ability to clear errors for a specific type(s).

  • clearErrors()
  • clearErrors(['presence', 'length'])
@offirgolan
Copy link
Collaborator Author

I was able to approach this in a much simpler way that doesnt require any change for this library. I created a demo app to illustrate this

https://github.com/offirgolan/clear-cp-demo

Feel free to clone, npm i && bower i then ember s to see it in action. The demo is based on the demo app of this library but with a reset functionality. To see the changes I made, you can look at this commit

@frank06
Copy link

frank06 commented Sep 17, 2016

I can't seem to find any connection between the "reset functionality" in the sample app (which overrides a component and is pretty contrived using didValidate) and why clearErrors or similar have not been implemented.

In a component I have a property called current which backs a form. It is a fragment, created via this.store.createFragment. When current is saved, it's sent up via an action. Until here validations work perfectly well. Then, current is then reset to a brand-new fragment. When that happens all blank fields now show validation errors (presence).

I need a way to tell ember-cp-validations that the model/fragment is a new, untouched one. That it should not attempt to validate until the user tries to make a selection/change. So, how can I do that? Thanks!

@escobera
Copy link

I'm needing this as well. @offirgolan What is the current way to achieve this behaviour?

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