This question is locked. New answers and comments are not allowed.
Robert Mullen
Top achievements
Rank 1
Robert Mullen
asked on 25 Feb 2010, 07:03 PM
Is there a way to disable input to these controls?
7 Answers, 1 is accepted
0
Hello Robert Mullen,
Currently you can disable the input control of the datepicker only with javascript. You can use this code snippet to achieve your goal:
In next major release the numeric textboxes and datepicker will include server InputHtmlAttributes(...) method, which will allow to apply attributes to the input controls in the components.
Kind regards,
Georgi Krustev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Currently you can disable the input control of the datepicker only with javascript. You can use this code snippet to achieve your goal:
function disable(){ var input = $('#DatePickerId').find('> .t-input'); input.attr("disabled", true);}In next major release the numeric textboxes and datepicker will include server InputHtmlAttributes(...) method, which will allow to apply attributes to the input controls in the components.
Kind regards,
Georgi Krustev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
atul ap
Top achievements
Rank 1
answered on 10 Mar 2010, 09:42 AM
hi,
I was trying to do the same. The solution given works fine; but how to disable the button that invokes calendar popup?
Thanks,
Atul
I was trying to do the same. The solution given works fine; but how to disable the button that invokes calendar popup?
Thanks,
Atul
0
Hello Atul,
Link tag cannot be disabled like input tag. To achieve your goal, you can wire the onclick event of the button and return false. Here is a code snippet showing how to disable the button:
I have to mention that we also wire onclick event internally in order to show the calendar. Hence if you need to enable the button you should use this code:
Regards,
Georgi Krustev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Link tag cannot be disabled like input tag. To achieve your goal, you can wire the onclick event of the button and return false. Here is a code snippet showing how to disable the button:
function disableButton(){ if(datePicker){ $('#DatePicker > .t-icon').unbind('click') $('#DatePicker > .t-icon').bind('click', function(){return false;}) }}I have to mention that we also wire onclick event internally in order to show the calendar. Hence if you need to enable the button you should use this code:
function enableButton(){ datePicker = $('#DatePicker').data('tDatePicker'); if(datePicker){ $('#DatePicker > .t-icon').unbind('click') $('#DatePicker > .t-icon').bind('click', $.proxy(datePicker.togglePopup, tdatePicker)) }}Regards,
Georgi Krustev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
atul ap
Top achievements
Rank 1
answered on 10 Mar 2010, 11:56 AM
Thanks Georgi!
I could implement Disable functionality, Enable is not working.
Code is like following:
I could implement Disable functionality, Enable is not working.
Code is like following:
| function disableButton() { |
| datePicker = $('#FromDate').data('tDatePicker'); |
| if (datePicker) { |
| var input = $('#FromDate').find('> .t-input'); |
| input.attr("disabled", true); |
| $('#FromDate > .t-icon').unbind('click') |
| $('#FromDate > .t-icon').bind('click', function() { return false; }) |
| } |
| else { |
| var input = $('#FromDate').find('> .t-input'); |
| input.attr("disabled", false); |
| $('#FromDate > .t-icon').unbind('click') |
| $('#FromDate > .t-icon').bind('click', $.proxy(datePicker.togglePopup, tdatePicker)) |
| } |
Thanks,
Atul
0
Hello atul ap,
The enabling of the button will not work, because datePicker will always exist. Use two separate methods instead.
Greetings,
Georgi Krustev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
The enabling of the button will not work, because datePicker will always exist. Use two separate methods instead.
Greetings,
Georgi Krustev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
atul ap
Top achievements
Rank 1
answered on 11 Mar 2010, 11:02 AM
Thanks Georgi for the reply.
Actually I have a button using which I will enable or disable the datepicker control.
As we can't assign two different methods for "onclick" of a button, I have to implement
the functionality in a single function. The code I have given was the same function
called on "OnClick".
Lets see we can find any solution.
Regards,
Atul
Actually I have a button using which I will enable or disable the datepicker control.
As we can't assign two different methods for "onclick" of a button, I have to implement
the functionality in a single function. The code I have given was the same function
called on "OnClick".
Lets see we can find any solution.
Regards,
Atul
0
jmo
Top achievements
Rank 1
answered on 18 Nov 2010, 05:46 PM
Just dealt with same issue, but the enable code snippet is wrong, it should be as follows (change in bold, scroll right--->):
function enableButton(){ datePicker = $('#DatePicker').data('tDatePicker'); if(datePicker){ $('#DatePicker > .t-icon').unbind('click') $('#DatePicker > .t-icon').bind('click', $.proxy(datePicker.togglePopup, datePicker)) }}