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

Prevent Date Picker from showing calendar when clicking in text box

1 Answer 59 Views
Date/Time Pickers
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Makoto
Top achievements
Rank 1
Makoto asked on 07 Dec 2010, 04:55 PM
I'd like to make it so that the calendar only shows up when they click on the calendar button.  If they click in the textbox, I don't want it to automatically show the calendar.

There are a lot of people here that just prefer to manually enter the date without the calendar, however, I like all the other functionality, such as validation, auto formatting, etc.

Is there a simple way to do this?

1 Answer, 1 is accepted

Sort by
0
Hristo Germanov
Telerik team
answered on 08 Dec 2010, 12:55 PM
Hello Makoto,

Thank you for contacting us.

In order to achieve your goal you need to:
1. Unbind input "focus" client event.
2. Bind "click" with functionality for open and close DatePicker client methods.

 JavaScript code snippet:
function onLoad(e) {
    var dp = $(this).data('tDatePicker');
    dp.$input.unbind('focus');
    $(this).find('.t-icon-calendar')
            .unbind('click')
            .bind('click', function () {
                if (dp.dateView.isOpened()) {
                    dp.close();
                } else {
                    dp.open();
                }
            });
}

I have attached a sample project that shows how to do that.

Greetings,
Hristo Germanov
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
Tags
Date/Time Pickers
Asked by
Makoto
Top achievements
Rank 1
Answers by
Hristo Germanov
Telerik team
Share this question
or