简体   繁体   中英

Kendo Validate - Ignore Specific Inputs

I am using Kendo validation to do some light front end validation.

I am using an external API, that does the back end validation for me, so I only need to validate a few inputs for format/required.

Currently, it is validating every input.

How can I specify elements to ignore.

I realize I can specify specific elements to validate, but I don't want to take this approach, as there are way more elements to validate than not to validate.

Thanks,

You can set the disabled attribute on the input element for him to be ignored.

<input type="text" disabled></input>

in jquery:

$("input").prop("disabled",true);

or

$("input").attr("disabled","disabled");

The basic form element ignores the disabled fields for validation and serialization, I tried on with kendo validator and it works.

Here the question for html form: How can I manipulate a form / inputs to be ignored when a form is submitted

Hope it helped! :)

UPDATE

Just found that if you set to the input element the attribute "data-validate='false'" he will ignore because he uses this selector to get all the inputs to validate:

"$(':input:not(:button,[type=submit],[type=reset],[disabled],[readonly])[data-validate!=false]')"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM