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

Access to error message(s) #607

Closed
PureDude opened this issue Apr 11, 2014 · 4 comments
Closed

Access to error message(s) #607

PureDude opened this issue Apr 11, 2014 · 4 comments

Comments

@PureDude
Copy link

How do I get access to the error message(s) in following context.
e.$element.data('error-message') doesn't work. It would be great if you had a solution!

$.listen('parsley:field:error', function (e) {

    errorMsg = e.$element.data('error-message');

    e.$element
        .attr('data-content', errorMsg)
        .popover('show');

});
@guillaumepotier
Copy link
Owner

Hi, I've added a ParsleyUI.getErrorsMessages(parsleyFieldInstance) method that will return an array of messages errors.

It is available on master branch and would be released in next stable version.

Best

@PureDude
Copy link
Author

Hi, thx! It works perfectly and that was exactly what I was looking for. I needed this for an integration with bootstrap popovers and if someone this looking also, my sample code can be found at the following link:
http://stackoverflow.com/questions/23008008/display-parsley-errors-in-bootstrap-tooltip

@guillaumepotier
Copy link
Owner

Great,

What would be awesome if you have some time, would be to make a PR and add your example directly in documentation, among others examples :)

Best

@btburton42
Copy link

@guillaumepotier i have multiple constraints on a single element (min-length, alphanum, required, etc). is there any way to currently return an array of all the unsatisfied constraints on an element?

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