PDA

View Full Version : [FIXED] DateField gives wrong error messages



mstguy01
22 Aug 2008, 3:36 AM
This was posted in the Help forum and moved here when it was determined that it is probably a bug.

I am using gxt 1.0.2. I searched the forums but couldn't find anybody else mentioning this problem.

When entering various values in the field portion of a DateField I noticed that the tooltip message does not change when different errors are encountered; it always shows whatever message was shown first.

For example, I do the following
1) set the format to 'yyyy/MM/dd', the maximum date to 2008/08/20, and set to auto validate.
2) change the text field to contain 2008/08/21 -
3) change the text field to 2008/08/20 - valid date so no tooltip.
4) change the text field to 2008/08/a - "... must be equal to or before 2008/08/20" tooltip appears rather than the 'invalidText' message.

If I do the same thing in a different DateField but reverse steps 2 & 4 then the error message shown is always the 'invalidText' message.

Here's some code with two DateFields to play with.


public void onModuleLoad() {

DateTimeFormat format = DateTimeFormat.getFormat("yyyy/MM/dd");

DateField dateField1 = new DateField();
DateField dateField2 = new DateField();

dateField1.setAutoValidate(true);
dateField2.setAutoValidate(true);

dateField1.getPropertyEditor().setFormat(format);
dateField2.getPropertyEditor().setFormat(format);

Date maxDate = new Date();

maxDate.setDate(maxDate.getDate()-1);

dateField1.setMaxValue(maxDate);
dateField2.setMaxValue(maxDate);

dateField1.setValue(maxDate);
dateField2.setValue(maxDate);

RootPanel.get().add(dateField1);
RootPanel.get().add(dateField2);
}The exclamation icon and tooltip show up way to the right on the screen but it should illustrate the point.

darrellmeyer
23 Aug 2008, 7:01 AM
Fixed in SVN.