tstancin
tstancin

Reputation: 268

Knockout Kendo TimePicker disable user text input

How to disable user text input in Kendo UI TimePicker using knockout-kendo binding?

In my non knockout-kendo project I managed to do it using (jsfiddle example here):

$('#timepicker').attr('disabled', 'disabled');  //disable user text input

That way the control dropdown is active, users can pick time values, but cannot type into the box, which is exactly what I want.

Now I'm working with knockout-kendo binding, and I can't find any option to disable user text input. (jsfiddle knockout-kendo example here). Is there a way to do that?

Upvotes: 1

Views: 830

Answers (2)

manji
manji

Reputation: 47978

You could just use the 'enable' binding on the #timepicker:

<input id="timepicker" 
       data-bind="kendoTimePicker: { value: startTime, format: 'HH:mm' },
       enable: false" />

Demo: JSFiddle.

Upvotes: 1

RP Niemeyer
RP Niemeyer

Reputation: 114792

The binding supports an enabled option that you can bind against a boolean observable.

Something like:

<input data-bind="checked: isStartTimeEnabled" type="checkbox" />
<input id="timepicker" data-bind="kendoTimePicker: { value: startTime, format: 'HH:mm', enabled: isStartTimeEnabled }" />

Sample: http://jsfiddle.net/rniemeyer/R5NxJ/

Upvotes: 1

Related Questions