Results 1 to 6 of 6

Thread: Clear a DateField?

  1. #1

    Default Clear a DateField?

    I have a site that a user will be entering date ranges. The site is multilingual and the language/date format is set by an administrator. Due to this I can find no "good" way to validate when a user enters, for example, 01/07/2009 if they mean Jan 7 or July 1. To remove this issue I made the requirement that the user must use a calendar control of some sort. I would like to use the DateField but if I make it editable: false I do not see a clean way to give the user the ability to clear out the date field. Is there some way that I am missing or is the best way to override the "Today" button to be a clear button?

  2. #2

    Default Seems pretty simple?

    What if you add an additional "Clear Fields" button that would empty the value?

    The button handler should probably be something like yourDateField.reset();


  3. #3


    Oh, outside of the datefield altogether? I suppose I would have to add a button on both fields to allow them to be cleared individually. I am worried that it may not be clear what those buttons do if I make them small such as a red x, but if I actually have text in them that says "Clear field" then I will be taking up a lot more room and the interface will look crappy. No way to create anything inside the datepicker?

  4. #4
    Sencha User aconran's Avatar
    Join Date
    Mar 2007


    Yes, you could update the today button to use the text "Clear" and reset the calendar control.

    Take a look at Ext.DatePicker which is used by the Ext.form.DateField.

    You will want to set todayText to "Clear" and override the selectToday handler to reset the value instead of set it.
    Aaron Conran

  5. #5
    Ext JS Premium Member
    Join Date
    Oct 2011

    Exclamation it is clearly a bug

    you can input date by hand but you cant clear it. it shold be out of the box functionality efter edit if rawValue == '' value = null .

    Does anybody got working override?

  6. #6
    Sencha User
    Join Date
    Jan 2011


    i have same problem, current;ly added context menu - to select which datefield to clear ... but am searching for solution, - to add another button at the bottom of calendar control.

    Here are some answers, maybe this will help, but i currently don't have answer ... if anybody find howto add reset button at datefield calendar pop - pls help me.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts