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

How to remove the autocomplete in the RadDatePicker and the RadDateTimePicker?

3 Answers 194 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Paul Tran
Top achievements
Rank 1
Paul Tran asked on 18 May 2010, 03:22 PM
Hi,

I noticed that there's an autocomplete in the RadDatePicker and RadDateTimePicker controls. It is really easy to reproduce, just delete the year in the date and get out of focus, the control will automatically fill it up with some kind of algorithm. 

Is it possible to turn off this feature?

Thanks,
Paul

3 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 21 May 2010, 02:48 PM
Hello Paul,

Unfortunately there is no straightforward way to turn off this functionality. You could override the built-in parsing but I don't recommend that you do this.
<script type="text/javascript">
    Telerik.Web.UI.RadDateInput.prototype.parseDate = function (value, baseDate)
    {
        if (new Date(value) != "NaN")
            return new Date(value);
        this.set_textBoxValue(value);
    }
</script>

Best regards,
Daniel
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
Andrew Zhao
Top achievements
Rank 1
answered on 06 Aug 2010, 09:11 PM
I had the samiliar issue. I added overidden parseDate function as suggested, it wouldn't auto correct the input date. However, it won't accept two-digit year like '7/15/10', how do I make it take both 2-digit and 4-digit year?
Second question, assume that an invalid date '13/1/2010' enter, the OnError event invokes, then I change to '1/1/2010' by simply deleting '3'. At this moment, I found that no ValueChanging event is triggered. How to capture the changes when delete key pressed?
0
Daniel
Telerik team
answered on 12 Aug 2010, 08:42 AM
Hello Andrew,

I had the samiliar issue. I added overidden parseDate function as suggested, it wouldn't auto correct the input date. However, it won't accept two-digit year like '7/15/10', how do I make it take both 2-digit and 4-digit year?
It is expected that the control won't convert such dates automatically given the fact that the parsing logic is overridden (which is not supported scenario). You should either implement you own parsing algorithm or leave the default functionality intact.

Second question, assume that an invalid date '13/1/2010' enter, the OnError event invokes, then I change to '1/1/2010' by simply deleting '3'. At this moment, I found that no ValueChanging event is triggered. How to capture the changes when delete key pressed?
You could handle the onkeydown or onkeyup events.
<telerik:RadDatePicker runat="server" ID="RadDatePicker1">
    <DateInput onkeydown="myFunction()" />
</telerik:RadDatePicker>

Regards,
Daniel
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
Calendar
Asked by
Paul Tran
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Andrew Zhao
Top achievements
Rank 1
Share this question
or