Opened 5 years ago

Closed 4 years ago

#18276 closed defect (patchwelcome)

dojox/form/DateTextBox using dojox/widget/MonthAndYearlyCalendar, once set, cannot be cleared

Reported by: psbucky Owned by: dante
Priority: undecided Milestone: 1.13
Component: DojoX Form Version: 1.10.1
Keywords: Cc:
Blocked By: Blocking:

Description

I am trying to implement an optional month/year selector.

It seems like it SHOULD be as straightforward as:

<span id="foo" data-dojo-type="dojox/form/DateTextBox" data-dojo-props="required:false,constraints:{datePattern:'MM/yyyy'},popupClass:'dojox.widget.MonthAndYearlyCalendar'"></span>

Focusing and blurring leave the field blank, and without error, as expected.

However, once a value is accepted by the widget, it cannot be cleared for love nor money.

Please see attached for example.

Attachments (1)

test.html (2.0 KB) - added by psbucky 5 years ago.
Example file demonstrating the problem.

Download all attachments as: .zip

Change History (5)

Changed 5 years ago by psbucky

Attachment: test.html added

Example file demonstrating the problem.

comment:1 Changed 5 years ago by psbucky

More info:

It would seem that you can set and clear the date PROVIDED you do NOT open the popup.

Once you open the popup, even if you choose nothing, a blur event will set the text field to today.

comment:2 Changed 5 years ago by bill

Component: GeneralDojoX Form
Owner: set to dante

comment:3 Changed 5 years ago by psbucky

This works:

For a widget named "widget," destroy the "dropDown" sub-widget, and set the "dropDown" field to null immediately after closing the drop-down (just doing destroy() didn't work for me). That seems to be the thing that makes the unwanted date value appear, somehow.

Since dijit/form/_DateTimeTextBox deletes the dropDown before every "openDropDown" method, I think I'm requesting that the drop down be destroyed sooner than that--on close.

I don't actually know if the defer is necessary. I'll leave that to wiser programmers.

	aspect.after(widget,'closeDropDown',function(){
		if(widget.dropDown) {
			widget.defer(function(){
				widget.dropDown.destroy();
				widget.dropDown=null;
			});
		}
	});

comment:4 Changed 4 years ago by dylan

Milestone: tbd1.12
Resolution: patchwelcome
Status: newclosed

Given that no one has shown interest in creating a patch in more than a year, I'm closing this as patchwelcome. Please let us know if you would like to get involved in helping make this change to Dojo!

Note: See TracTickets for help on using tickets.