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

How to force user to input only items on Combobox

1 Answer 191 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Nurali
Top achievements
Rank 1
Nurali asked on 04 Dec 2013, 01:00 PM
Hello ,i m using Kendo grid with pop-up edit mode.I have created custom template page for pop-up window.On this template there are some comboboxes.
I want user that can input(on combo's textarea)  only from combobox's value.

E.g.:

Combobox-Values: red,yellow,green

When user fill the combobox's textarea like "RED" or "Yellow" validator message should appears and ,update button should return false such required = "required"
does on combobox.

@(Html.Kendo().ComboBox()<br>
            .Name("IDTYPE")<br>
                                    //.AutoBind(false)<br>
                         //.Events(e => e<br>
                         //               .Change("combobox_select"))<br>
                    .DataTextField("DESCRIPTION").HtmlAttributes(new { style = "width:220px", required = "required" })<br>
            .DataValueField("REFERENCEID")<br>
                                    //   .Value(Model.IDTYPEGUID.ToString()) // Initial value<br>
                                    //  .BindTo(Model.IDTYPE) <br>
                                    //.AutoBind(true)   <br>
                     .Placeholder("SELECT")<br>
<br>
                        .DataSource(source =><br>
                        {<br>
                            source.Read(read =><br>
                            {<br>
<br>
                                read.Action("GetDefinitionDetails", "Definition", new { definitionCode = "IDTYPE", addEmptyRow = false })<br>
                                    //  .Data("onAdditionalData")<br>
                                ;<br>
<br>
                            })<br>
              .ServerFiltering(true);<br>
<br>
                        }))

1 Answer, 1 is accepted

Sort by
0
Alexander Popov
Telerik team
answered on 05 Dec 2013, 02:07 PM
Hi Nurali,

In the current scenario I would recommend you to initialize a KendoUI Validator and define a custom rule that checks if the ComboBox widget has a valid dataItem. You can find additional information on that topic here.

Regards,
Alexander Popov
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
ComboBox
Asked by
Nurali
Top achievements
Rank 1
Answers by
Alexander Popov
Telerik team
Share this question
or