parsley.js

Exclude invisible Inputs with parsley.js 2.x


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


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)