question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Remove need for `addError`, `removeError`, ...

See original GitHub issue

With the right set of feature, there shouldn’t be a need for addError, updateError and removeError.

Others?

Issue Analytics

  • State:open
  • Created 8 years ago
  • Comments:18 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
vedraancommented, Apr 21, 2016

I’m using v2.3.11 and there appears to be no addError() method on the instance: $('#login-form').parsley().addError is undefined so I was wondering how do I manually activate errors now since calling window.ParsleyUI.addError directs me to this issue.

The docs seem to be out of date and still suggest using window.ParsleyUI.addError.

My use case is that I use an API which does not have a possibility to AJAX check if the a field is valid. I only get errors after POSTing the entire form, e.g. if I submit a register form the API might respond with:

{
    "message": "VALIDATION_ERROR",
    "body": {
        "error_fields": {
            "email": {
                "failed_rule": "Unique",
                "message": "The email has already been taken."
            },
            "password": {
                "failed_rule": "Complexity",
                "message": "The password is not complex enough."
            }
        }
    }
}

Which is a great response which I can easily traverse and map the error message to the proper fields, but I can not see how that is possible with the latest Parsley version.

This is a very simple example, but I’m dealing with very complex CMS forms which can return errors for multiple fields with no way to validate all the error types client-side before submit.

I could of course display bulk server messages or render them manually in each error container but I would love using Parsley for this since I’m already using it for client side validation.

3reactions
vedraancommented, Apr 21, 2016

I was convinced I tried it on field instance as well, but probably missed something. Anyway if someone else finds this thread like me here’s a little help on how to do it (at least until the docs get updated).

$('[name="email"]').parsley().addError('error-1', { message: 'Message for error-1' }); // add error message
$('[name="email"]').parsley().addError('error-2', { message: 'Message for error-2' }); // add one more error message
$('[name="email"]').parsley().removeError('error-1'); // remove first message
Read more comments on GitHub >

github_iconTop Results From Across the Web

addError and removeError dynamically parsley with laravel
Disable /enable an input with jQuery? 2701 · Open a URL in a new tab (and not a new window) · 2693 ·...
Read more >
remove error message in javascript in lwc
It's a matter of asynchronous rendering. When you update the value of this.infoToggleValue , you need to allow some time for the isRequired ......
Read more >
Add, change, or remove error bars in a chart - Microsoft Support
On 2-D area, bar, column, line, xy (scatter), or bubble chart, do one of the following: To add error bars to all data...
Read more >
Error while using adderror in a trigger while delete operation
Have even used return; keyword after adding the adderror functionality inorder to avoid the other operations to be handled but even then this ......
Read more >
How to add or remove error bars in Excel - YouTube
In this video tutorial, we'll be having a look at How to add or remove error bars in Excel in a free and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found