Disabling Manual Inputs for KendoUI Elements

I use several KendoUI elements like ComboBox, DatePicker etc. everything works fine, but there is one serious problem that these items actually allow you to enter manually.

For example, in a comboBox, which I can print by clicking on it, which activates the text field, which is really dangerous and spoils the purpose of using elements of the <select> type list, the same thing happens with the choice of date.

So, you can specify how I can disable these manual inputs and restrict the user to only the choice of available parameters.

 <input id="date" value="@DateTime.Now.Date"/> <select name="need" id="need"> <option value="1">High</option> <option value="2">Normal</option> <option value="3">Low</option> </select> <script type="text/javascript"> $("#date").kendoDatePicker(); $("#need").kendoComboBox(); </script> 

Unwanted help.

+4
source share
4 answers

If the datepicker parameter is disabled, it will not be sent to the server. Better use the readonly attribute.

+5
source

If you do not want users to enter text, use DropDownList instead of combobox. To select a date, you can easily disable the input element that you convert to a date picker using jQuery.

Check out this script :

  $(document).ready(function() { // create DatePicker from input HTML element var datepicker = $("#datepicker").kendoDatePicker(); $("#datepicker").prop('disabled', true); }); 
+2
source

to prevent manual entry, you need access to the text input field inside the telerik template:

 var input = $(#"combobox").data("kendoComboBox").input; input.attr("readonly", "readonly"); 
+2
source

dropdownbox () works this way, not combobox () unless it's an editable combobox.

0
source

All Articles