What Parsely configuration options set the CSS classes for error/success?

99 views Asked by At

I'd like to add my own CSS class to the input fields, or associated elements, on validation failure or success. For example to facilate testing I'd like to add a "qa-val-fail" CSS class for detection by Selenium. Ideally I'd like to add multiple classes.

In the Parsley documentation it says:

Customize your classes

You could change these classes' names in configuration, and the class holder element too.

but there is no further mention in the documentation of which configuration settings achieve this.

I have seen a few SOs with techniques using event listeners, but I'm hoping not to have to do that.

2

There are 2 answers

1
Marc-André Lafortune On BEST ANSWER

Check the doc of the defaults, you'll find successClass and errorClass.

0
scipilot On

I found the answer here: https://stackoverflow.com/a/25610173/209288

And this allows me to add multiple classes:

$(selector).parsley({
            successClass: "qa-validation-success parsley-success",
            errorClass: "qa-validation-error parsley-error"
  });