Ticket #3999 (new bug)

Opened 19 months ago

Last modified 19 hours ago

Clear button and functionality removed

Reported by: jain.ashish21 Owned by:
Priority: minor Milestone: 1.next
Component: ui.datepicker Version: 1.6rc5
Keywords: clear button Cc: jain.ashish21@…

Description

The clear button and functionality were removed from UI 1.6 rc1+ onwards. But this makes it impossible to clear the existing date, if any, when the control is readonly.

Change History

follow-ups: ↓ 3 ↓ 9   Changed 19 months ago by joern.zaefferer

  • milestone changed from TBD to 1.next

Could you explain the usecase for this?

  Changed 19 months ago by NVRAM

IIUC, when using: showOn:'both' there is no way for a user to erase the value and specify no date with a blank entry.

But there might be a method I missed, in my case (1.6rc6) I switched to showOn:'button'

in reply to: ↑ 1   Changed 15 months ago by m2x

Replying to joern.zaefferer:

Could you explain the usecase for this?

example usecase is clearing a date when input field is readonly (the reason for doing it readonly as here: http://dev.jqueryui.com/ticket/4079#comment:3)

  Changed 10 months ago by boteeka

Clear functionality is definitely needed. I spent half a day Googling and trying to find some workaround to clear the selected dates. Without this functionality there is no way I can reset the form, and I think this is a serious shortcoming.

Please add this functionality, as it seems a lot of people need it.

  Changed 6 months ago by zirconx

I would really like to see this feature added, too. I might have to switch to a different calendar that supports this.

I've seen some discussion that this feature isn't needed because the user can just clear the field - NOT TRUE. On most of the sites I've worked on that use a date picker the field is READ ONLY. Often times the server expects the date in a certain format so the user isn't allowed to just type in whatever they want - instead they are forced to use the date picker. So we need a clear option please. :-)

  Changed 4 months ago by maderic_m

I think it is necessary to implement this option, given that the field is read only once you enter a date can not be erased, thanks

  Changed 4 months ago by boomyjee

here is my solution, you can use done button as clear with the following hack

$(".datepicker").datepicker({

showButtonPanel: true, closeText: 'Clear',

});

$.datepicker._generateHTML_Old = $.datepicker._generateHTML; $.datepicker._generateHTML = function(inst) {

res = this._generateHTML_Old(inst); res = res.replace("_hideDatepicker()","_clearDate('#"+inst.id+"')"); return res;

}

  Changed 5 weeks ago by keir

I created a fork of jquery which supports the clear option. You have to enable the button bar and also add { showClearButton : true } to the options.

 http://github.com/keir/jquery-ui/commit/25e55ff73df768360a2260534a4afa6e03f04fb

I sent a pull request to the jquery-ui maintainers; hopefully they will reconsider the removal of this feature and merge my pull request.

in reply to: ↑ 1   Changed 19 hours ago by jbcoder2

Replying to joern.zaefferer:

Could you explain the usecase for this?

Using 2 DatePicker? that are tied together to define a date range. Clearing the text from either text input does not clear the date in the underlying DatePicker? object or the restrictions that are imposed by the previously selected date.

Note: See TracTickets for help on using tickets.