1

Looking in the docs they only offer examples with data attributes, I need to write a different js file for a form and do something like:

$('#myform').parsley(options);

I want to know the available methods in options, and apply validators to inputs and then print custom messages.

It is possible?

  • I think this is similar to: http://stackoverflow.com/questions/29246268/configure-parsley-using-javascript-not-html-data-attributes – ds111 Mar 31 '15 at 14:57

1 Answers1

1

Yes, just use the camel case equivalent. See also the defaults

$('#myform').parsley({errorClass: 'oups'});

Some javascript methods are in the documentation, others you have to look in the source.

For example, (see this on how to add the corresponding validator):

$('#myform').parsley().addConstraint('isMultiple', 42) 
Marc-André Lafortune
  • 78,216
  • 16
  • 166
  • 166
  • Hi Marc, thanks for the replay, I'm looking for something like this http://stackoverflow.com/questions/21392813/parsley-custom-error-message-doesnt-work but in javascript, I don't see a way in defaults.js do you think is possible? – Alexis Moreno Mar 10 '15 at 23:16
  • http://parsleyjs.github.io/Parsley-1.x/documentation.html#javascript this but in version 2.* – Alexis Moreno Mar 10 '15 at 23:21
  • Edited answer, hope this is better. PRs for documentation more than welcome :-) – Marc-André Lafortune Mar 25 '15 at 03:46