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

[Solved] How to disabled the NumericTextBox onload ANSWER

0 Answers 104 Views
NumericTextBox
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
andy
Top achievements
Rank 1
andy asked on 24 Jun 2010, 05:36 AM

Seems every second post is about disabling the NumericTextBox
I have a answer the following scenario:

I wanted the input grayed out on page load (disabled)
BUT I wanted the spinners to be functional

Html.Telerik().PercentTextBox().HtmlAttributes(new { disabled = "disabled" })

Then when the spinner is activated, I want the textbox enabled:   ClientEvents(events => events.OnChange("Changed"))

function Changed(e) {
    TogglePercentage(e.target, true);
    TotalSplit -= e.oldValue;
    TotalSplit += e.newValue;
    if (TotalSplit > 100) {
        alert('Total needs to be less than or equal to 100%');
    }

function TogglePercentage(TextBox, enable) {

    if (enable)
         TextBox.find('> .t-input').removeAttr('disabled');
    else TextBox.find('> .t-input').attr('disabled'true);
}





Tags
NumericTextBox
Asked by
andy
Top achievements
Rank 1
Share this question
or