Question

How do I tell the parsley-Instance to exclude not visible form elements?

I found this in the Documentation:

data-parsley-excluded="input[type=button], input[type=submit], input[type=reset], input[type=hidden], [disabled], :hidden"

But I dont now where to set this Option? How can I parse this option to the Constructor?

Further Info: I am binding parsley to my form with jQuery("#formid").parsley();

Thanks a lot. Greets

Était-ce utile?

La solution

Either do:

jQuery("#formid").parsley({ excluded: "input[type=button], input[type=submit], input[type=reset], input[type=hidden], [disabled], :hidden" });

Or

window.ParsleyConfig = { excluded: "input[type=button], input[type=submit], input[type=reset], input[type=hidden], [disabled], :hidden" };
<script src="parsley.js"></script>

(see http://parsleyjs.org/doc/index.html#psly-usage-global-configuration)

Autres conseils

To disable globally, I added this to the same js page where I set up custom validators, ie:

  window.Parsley.options.excluded = "input[type=button], input[type=submit], input[type=reset], input[type=hidden], [disabled], :hidden" ;

  window.Parsley.addValidator('noemoji', {
    requirementType: 'boolean',
    ...

With parsley.js v2.9.2, I works with two ways,

First, global config, quote from rossinboulder

window.Parsley.options.excluded = "input[type=button], input[type=submit], input[type=reset], input[type=hidden], [disabled], :hidden" ;

Second, From document, set on form

<form data-parsley-excluded="input[type=button], input[type=submit], input[type=reset], input[type=hidden], [disabled], :hidden">
...
</form>

I didn't find the way to set in global config from document now, that's really strange...

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top