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

Numeric TextBox enable & disable on checkbox value

3 Answers 1955 Views
NumericTextBox
This is a migrated thread and some comments may be shown as answers.
Anshita
Top achievements
Rank 1
Anshita asked on 10 Oct 2014, 08:13 AM
I am working on MVC project using knockout JS.

I need to enable & disable the kendoNumericTextbox control on checkbox value. 

But I need to disable the numeric control when checkbox is checked. i.e if
checked = true then enabled = false. Is there a way to pass the inverse value
to numeric enabled option.

And I have to implement similar functionality to KendoDatepicker. Could you
please suggest any solution for both the controls. Here is my code - 

 <input class="" type="text"
data-bind="kendoNumericTextBox: {value:FloatValue, min: 0.01, decimals: 2,
format: 'n2' , enabled:CheckboxValue} " />
   

 <input type="checkbox" data-bind="checked:
CheckboxValue">  Null

3 Answers, 1 is accepted

Sort by
0
Kiril Nikolov
Telerik team
answered on 14 Oct 2014, 07:06 AM
Hi Anshita,

Both Kendo UI DatePicker and Kendo UI NumericTextBox have enable() methods that you can use to enable/disable the widget. Passing true for enabling and false for disabling. The documentation about these methods is available here:

http://docs.telerik.com/kendo-ui/api/javascript/ui/numerictextbox#methods-enable

http://docs.telerik.com/kendo-ui/api/javascript/ui/datepicker

As for handling the checkbox values, you can use simple jQuery statement is(':checked') that will return the state of the checkbox.

Regards,
Kiril Nikolov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Anshita
Top achievements
Rank 1
answered on 14 Oct 2014, 09:19 AM
Hi Kiril,

Thank you very much for the reply.
But I need to pass the inverse value of the checkbox. i.e
if checkbox.checked = true then kendodatepicker.enabled = false.
And with knockoutJS I have both checkbox & kendodatepicker as observable properties so I can synchronise them.
other non kendo controls have disabled attribute so it works fine with this scenario.
But I think kendo controls do not have disabled attribute.

Thanks,
Anshita
0
Accepted
Kiril Nikolov
Telerik team
answered on 15 Oct 2014, 10:54 AM
Hi Anshita,

The Kendo UI NumericTextBox does not have disable method implemented. 

As for the Knockout-kendo - this is an open source project that is not part of the official Kendo UI distribution and support, and therefore we will not be able to assist you on this matter.

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