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

Kendo ComboBox is not display error in validation summary

1 Answer 447 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Jason
Top achievements
Rank 1
Jason asked on 17 Mar 2014, 11:58 PM
I am able to display validation messages in our validation summary for any standard html control (textbox, drop down, etc).
When I replace my drop down with a Kendo ComboBox, the validation error will display next to the combobox, but will not display within the validation summary.  Is there something the needs to be done to get the ComboBox behave the same as the other controls on the page?

Please see the example view below.  I have two html textboxes, a kendo combobox, and a standard html drop down.  The two html textboxes and the drop down display validation messages within the summary as well as next the field.  The Kendo ComboBox validation message only displays a message next to the field - it's message does not appear in the summary.


@{
ViewBag.Title = "Home Page";
}
@model ValidationSummaryComboBox.Models.Customer
 
@section featured {
<div class="featured">
<div class="content-wrapper">
<hgroup class="title">
<h1>@ViewBag.Title.</h1>
<h2>@ViewBag.Message</h2>
</hgroup>
<p>
To learn more about ASP.NET MVC visit
<a href="http://asp.net/mvc" title="ASP.NET MVC Website">http://asp.net/mvc</a>.
The page features <mark>videos, tutorials, and samples</mark> to help you get the most from ASP.NET MVC.
If you have any questions about ASP.NET MVC visit
<a href="http://forums.asp.net/1146.aspx/1?MVC" title="ASP.NET MVC Forum">our forums</a>.
</p>
</div>
</div>
}
@using (Html.BeginForm())
{
@Html.ValidationSummary(false, "Fix these errors, please:")
@Html.TextBoxFor(m => m.FirstName)
<br />
@Html.TextBoxFor(m => m.LastName)
<br />

@( Html.Kendo().ComboBox()
.Name("FavoriteColor")
.Value(Model.FavoriteColor)
.DataTextField("Text")
.DataValueField("Value")
.BindTo(new List<SelectListItem>()
{ new SelectListItem() { Text = "Blue", Value = "1" },
new SelectListItem() { Text = "Red", Value = "2" },
new SelectListItem() { Text = "Green", Value = "3" },
new SelectListItem() { Text = "Yellow", Value = "4" } }))

<br />

@Html.DropDownListFor(m => m.FavoriteFood, new List<SelectListItem>()
{ new SelectListItem() { Text = "", Value = "" },
new SelectListItem() { Text = "Pizza", Value = "1" },
new SelectListItem() { Text = "Steak", Value = "2" },
new SelectListItem() { Text = "Raspberries", Value = "3" },
new SelectListItem() { Text = "Ice Cream", Value = "4" }})
 
<br />
<br />
<input type="submit" value="Save" id="save" class="k-button" />

<br />
}
 
<script>
// Initialize the Kendo UI Validator on your "form" containervar validator = $('form').kendoValidator().data("kendoValidator");
</script>


Please advise.
Thanks!

1 Answer, 1 is accepted

Sort by
0
Petur Subev
Telerik team
answered on 19 Mar 2014, 02:15 PM
Hello Jason,

The validation that you are using for the validation summary is not a Kendo validation, it is the jQuery validation. I assume this is happening because the input of the ComboBox is actually hidden input. Does the problem exist if you replace the ComboBox with an AutoComplete widget (since it does not rely on a hidden input)?

I case it works with an AutoComplete then I would suggest to search the internet for similar issues regarding jQuery validation.

Kind Regards,
Petur Subev
Telerik
 

DevCraft Q1'14 is here! Watch the online conference to see how this release solves your top-5 .NET challenges. Watch on demand now.

 
Tags
ComboBox
Asked by
Jason
Top achievements
Rank 1
Answers by
Petur Subev
Telerik team
Share this question
or