Numeric TextBox enable & disable on checkbox value

4 posts, 1 answers
  1. Anshita
    Anshita avatar
    4 posts
    Member since:
    Jan 2014

    Posted 10 Oct 2014 Link to this post

    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
  2. Kiril Nikolov
    Admin
    Kiril Nikolov avatar
    2566 posts

    Posted 14 Oct 2014 Link to this post

    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!
     
  3. Kendo UI is VS 2017 Ready
  4. Anshita
    Anshita avatar
    4 posts
    Member since:
    Jan 2014

    Posted 14 Oct 2014 in reply to Kiril Nikolov Link to this post

    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
  5. Answer
    Kiril Nikolov
    Admin
    Kiril Nikolov avatar
    2566 posts

    Posted 15 Oct 2014 Link to this post

    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!
     
Back to Top
Kendo UI is VS 2017 Ready