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

[Solved] autocomplete client validation not work!

1 Answer 140 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
mahmoud
Top achievements
Rank 1
mahmoud asked on 03 May 2011, 10:53 AM
I have the following autocomplete :
<div class="editor-field">
    @(Html.Telerik().AutoCompleteFor(model => model.Title)
            .Name("AutoComplete")
            .Encode(false)
            .HtmlAttributes(new { @class = "text-box", type = "text" })
            .BindTo(ViewBag.OldCustomersTitles as IQueryable<string>)
            .AutoFill(false)
            .HighlightFirstMatch(true)
                    .Filterable(filtering =>
                    {
                        filtering.FilterMode(AutoCompleteFilterMode.Contains).MinimumChars(5);
                    })
)
    @Html.ValidationMessageFor(model => model.Title)
</div>


the problem raises in client side validation which tells following javascript error : (the server side validation is ok)

$3.elements[0] is undefined

1 Answer, 1 is accepted

Sort by
0
mahmoud
Top achievements
Rank 1
answered on 03 May 2011, 11:42 AM
I found the problem!!!
it is because of the autocomplete's Name property. It should be set to the property name which is bound to (here Title) or simple remove it! also the viewbag object should not have the same property too!!! (i think it is the telerick autocomple control bug)
Tags
ComboBox
Asked by
mahmoud
Top achievements
Rank 1
Answers by
mahmoud
Top achievements
Rank 1
Share this question
or