guillaumepotier / Parsley.js

Validate your forms, frontend, without writing a single line of javascript

Home Page:http://parsleyjs.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Show proper error from localstorage

drkrtj opened this issue · comments

Hello,
Thanks for such a great script. I am new to jquery/javascript. I have a question. I am using your validator's events to store the errors into localstorage. This part works great.
What I am trying to achieve now is to load the "proper" error message back onto the page after a page refresh/crash. I can load a single error back onto the webpage but I would like the last error that was shown which could have been something like, "this is required", "this is not a valid email", or this email does not match the email above".
In other words, how can I get localstorage to select the correct error message? Maybe something like the script's getErrorMessage: function?
Thanks

What you are trying to do seems very involved and the benefit is not clear to me. It's unclear why you're simply not calling $('form').parsley().validate({force: true}) or similar to re-generate the error messages.
I'm sorry I am unwilling to answer you any further; please use StackOverflow for any followup questions.