We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Asp.net Core validation tag helper is ignored for the ej-drop-down-list

Hi Support:

I added the following script, but the validation tag helper is ibeing gnored for the required property:

  <ej-drop-down-list id="CityID" watermark-text="Select" datasource="@Model.Cities">
           <e-drop-down-list-fields text="Name" value="ID" />
  </ej-drop-down-list>
  <span asp-validation-for="CityID" class="text-danger" />


All the other input controls works fine, but this is the only Syncfusion control in the page in which the validation is not triggered.

What could I be missing here ?

Thanks in advanced

David


1 Reply

PO Prince Oliver Syncfusion Team February 11, 2017 11:44 AM UTC

Hi David, 

Thanks for contacting Syncfusion support. 

In JQuery validation plugin by default hidden inputs are excluded from being validated on form post. Our Dropdownlist maintains the value in the hidden input and hence it is getting excluded from validation. To overcome this issue, you need to clear the defaults in the validator. Refer to the following code snippet. 

<script> 
    $.validator.setDefaults({ 
        ignore: [],// To include hidden input validation. 
        errorClass: 'e-validation-error', // To get the error message on jquery validation 
        errorPlacement: function (error, element) { 
            $(error).insertAfter(element.closest(".e-widget"));// To place the error message 
        } 
    }); 
</script> 

We have attached a sample for your convenience. Refer to the following link for the sample: 

Regards, 
Prince 


Loader.
Up arrow icon