python ruby-programming-language Smalltalk Vue.js Knockoutjs TypeScript JavaScript, OOPs JavaScript Angular 8,7,6,5,4 and 2 Interview Questions and Answers Angular 8,7,6,5,4 and 2 Interview Questions and Answers Angular 4 Angular 2 AngularJs 1.x NodeJs Perl Programming R Programming RequireJs Rust Programming Backbonejs closure programming language go-programming-language kotlin-programming-language
Kendo ui dropdownlist validation mvc

Kendo ui dropdownlist validation mvc

The required validation of Kendo UI DropDownList not working some time so I'm going to share the code below for solving the same issues.




Table of Contents
      
  1. jQuery code sample.
  2. HTML 5 code sample.





Step 1 : for jquery example
//This is used for validate to KendoDropDownList.

function validateKendoDropDownList(e) {

    e.preventDefault();

    var validator = $("#formSubmit").kendoValidator().data('kendoValidator');

    var isValid = false;

    if (!(validator.validate())) {

        $("#lblMessage").text('Please select a tenant...');

        isValid = true;

    }

    return isValid;

}



$(document).ready(function () {

    $('#btnRegisterToACompany').click(function (e) {

        var isRequired = validateKendoDropDownList(e);

        if (!isRequired) {

            submtRegisterToACompany();

        }

    });

});

Step 1 : for HTML 5 code

<div id="formSubmit">
   <section class="well" style="height: 250px !important">     
       <div class="form-horizontal form-widgets col-sm-6"> 
           <label id="lblMessage" style="color:red;"></label>       
           <div class="form-group">
               <label for="language" class="control-label col-sm-4">Tenant</label>
               <div class="col-sm-8 col-md-6">
                   <input id="ddlTenants" />
               </div>
           </div>
           <div class="form-group">
               <label for="language" class="control-label col-sm-4">Company</label>
               <div class="col-sm-8 col-md-6">
                   <input id="ddlCompany" required />
               </div>
           </div>
           <div class="form-group">
               <label for="language" class="control-label col-sm-4"></label>
               <div class="col-sm-8 col-md-6 text-align_right">
                   <input type="button" value="Register to a company" id="btnRegisterToACompany" class="btn btn-primary" />
               </div>
           </div>
       </div>
    </section>
</div>



ANIL SINGH

Hi there! Welcome to my blog. My name is Anil Singh. I'm a author of this blog. For more detail about me, kindly refer to this link..
My Blogs - http://code-sample.com and http://code-sample.xyz
My Books - Interview Questions and Answers Books- Get Your Book in 15+ Digital Stores Worldwide..

You Might Also Like
www.code-sample.com/. Powered by Blogger.
ASK Questions