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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Validation message is not showing

Thread ID:

Created:

Updated:

Platform:

Replies:

130520 May 16,2017 07:23 PM UTC May 22,2017 04:27 PM UTC ASP.NET Core 3
loading
Tags: DropDownList
dsapo
Asked On May 16, 2017 07:23 PM UTC

Hi Support:

I need to include client side validation to my form that has several dropdownlist control in asp.net core.

My problem is that the validation works but the error message is not being displayed.

I tested your sample:

https://www.syncfusion.com/forums/128816/asp-net-core-validation-tag-helper-is-ignored-for-the-ej-drop-down-list

and works fine, but inside my web application is not working.  In my application I am using bootstrap, no idea if this could be creating this issue.  The strange thing is that no errors in the console.log

This is definition of a control:

<ej-drop-down-list id="Service" name="Service" width="100%" popup-height="100px" show-rounded-corner="true"
                                       datasource="@Model.Services" watermark-text="Select" 
                                       validation-rules='new Dictionary<string, object>() { { "required",true} }'  
                                       validation-message='new Dictionary<string, object>() { { "required","value required"} }'  >
                        <e-drop-down-list-fields text="Name" value="ID" />
</ej-drop-down-list>

<script type="text/javascript">

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

</script>



This is the rendered view of the control:

<input type="hidden" id="Service" class="e-dropdownlist e-js input-validation-error" tabindex="" value="" role="combobox" aria-expanded="false" aria-autocomplete="list" aria-haspopup="true" aria-owns="Service_popup" style="display: none;" name="Service" aria-required="true" aria-describedby="Service-error">

What could I be missing here that is causing that the error message is not being displayed.

Thanks in advance.

David


Prince Oliver [Syncfusion]
Replied On May 18, 2017 09:12 AM UTC

Hi David,   
  
Thank you for contacting Syncfusion support.   
  
We have prepared a sample with your class “input-validation-error” for validation error in Dropdownlist validation sample. Kindly refer to the following link for the sample: http://www.syncfusion.com/downloads/support/forum/130520/ze/CoreDropdownlist-1542162588 

If the issue persists at your end, please modify the above sample to reproduce the issue and revert it to us. It will help us isolate the root cause and provide solution.    
  
Regards,   
Prince   


dsapo
Replied On May 19, 2017 04:20 AM UTC

Hi Prince:

I found the issue but I dont know how to handle it.

My form also has a hidden field like this:

   @Html.HiddenFor( model=> model.ProductID)

This renders validation attributes because in my model this property has the [Required] annotation.

Also, my form has a couple of @HtmlEditorFor that are affecting the setDefaults in a similar way as the hidden field.

When the view only has dropdownlists it works as expected.

Any idea how to overcome this.

Thanks again

David

Keerthana Rajendran [Syncfusion]
Replied On May 22, 2017 04:27 PM UTC

Hi David, 
 
This issue occurs because  ignore: []  is given as an  empty array. We suggest you to pass the selector of DropDownList inside ignore:[$(“#id”)] when you use DropDownList along with some other input controls in the form. 
 
Regards, 
Keerthana. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;