Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Exclude invisible Inputs with parsley.js 2.x

Tags:

parsley.js

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

like image 684
user3507003 Avatar asked Apr 07 '14 13:04

user3507003


2 Answers

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)

like image 66
guillaumepotier Avatar answered Nov 05 '22 07:11

guillaumepotier


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',
    ...
like image 1
rossinboulder Avatar answered Nov 05 '22 07:11

rossinboulder