This is a migrated thread and some comments may be shown as answers.

Validate partial form

1 Answer 130 Views
This is a migrated thread and some comments may be shown as answers.
Daniel Blendea
Top achievements
Rank 1
Daniel Blendea asked on 21 Feb 2020, 09:55 AM


I have this valdiation summary:

<div asp-validation-summary="All" class="text-danger" >
    <span class="k-invalid-msg" data-for="Description" data-valmsg-for="Description"
        id="Description_validationMessage" role="alert" >
        ... more fields
<textarea asp-for="Description" class="form-control mc0" data-bind="value: ent.Description">

let viewModel = kendo.observable({
    save: function() {
        let editForm = $("#edit-form").kendoValidator().data("kendoValidator");
        if (editForm.validate()) {


Because of the business rules, I need to validate only certain fields, based on the current entity state.

Is there a way to validate only certain fields, like all fields with class "mc0" (or fields in a "div#id-for-state-X") and have the error messages displayed in the summary?


1 Answer, 1 is accepted

Sort by
Telerik team
answered on 24 Feb 2020, 03:21 PM

Hi Daniel,

This Dojo example demonstrates how we can use the submit event to add the "required" attribute to all elements that have the "needValidation" class.

In the above Dojo, if you click on the "Submit" button the below line will select all DOM elements that have "needValidation" class and will add the "required" attribute to these elements.

$(".needValidation").attr("required", true);

After that, the form will be validated based on the presence of the "required" attribute in the different DOM elements. 

There is also this line in the submit event function:

$('#ticketsForm').find("[required=\"required\"]").attr("required", false);

It removes all "required" fields before setting the same attribute to the elements that has the "needValidation" class.

I hope the above solution will help you resolve the issue in the application you are working on.

Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Asked by
Daniel Blendea
Top achievements
Rank 1
Answers by
Telerik team
Share this question