PDA

View Full Version : DateField gives wrong error messages


mstguy01
08-21-2008, 01:56 PM
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 but it should illustrate the point.

rgoncalves
08-21-2008, 02:34 PM
Hi! I'm currently evaluating ext-gwt for a new project. Since this project will have lots of forms, validation support ,etc... is crucial... But (probably because I'm not an gxt expert) i'm having the following problem:

Here's the code:
final NumberField my_id = new NumberField();
my_id.setFieldLabel("my Id");
my_id.setAllowBlank(false);
my_id.setMinLength(2);
my_id.setMaxLength(4);

1) enter "1" in the number field (error message: the minimum length for this field is 2" [OK]
2) enter "12345". The error message remais the same!! [NOT OK]
3) Remove any text from text field. The error message remais the same!! :-/ [NOT OK]

After the first error message is shown, never gets updated!

Any idea?


PS -> I'm trying GXT-1.0.2 & GWT 1.5.1

Thanks for any help.

gslender
08-21-2008, 05:19 PM
try this my_id.setAutoValidate(true)

rgoncalves
08-22-2008, 07:16 AM
Hi.. Thanks for the hint, but the problem remains the same. After showing the first error, the message never gets updated.
Even if:
1) insert an invalid value (msg length= 10) (shows correct error message)
2) Correct the value (error message is removed OK)
3) insert another invalid value (msg length = 1) (shows the same error message shown in step 1).

BUG?
Thanks.

gslender
08-22-2008, 07:24 AM
yes, could be a bug - best to post in the bug forum

mstguy01
08-22-2008, 07:36 AM
I will put this on the Bugs forum.