PDA

View Full Version : Beta3: Validators not working



ivotte
28 Feb 2012, 7:54 AM
Hi,

if I add a validator to a field, it often (but not always) validates an old value. I did not use the "autoValidate" function, but simply relied on "validateOnBlur". Thus, as soon as I leave the field and go to the next, the validator is executed an operated on an old value.

This issue seems to be similar to the following post:

http://www.sencha.com/forum/showthread.php?181850-Beta3-TextField-not-updating-it-s-underlying-value.&highlight=validator

I observed this behaviour with the following example program:



public void onModuleLoad() {
VerticalLayoutContainer c = new VerticalLayoutContainer();

// create field with validator
NumberField<Double> numberField = new NumberField<Double>( new NumberPropertyEditor.DoublePropertyEditor() );
numberField.getValidators().add( new AbstractValidator<Double>() {
public List<EditorError> validate(Editor<Double> editor, Double value) {
return createError( editor, "I reject all values! Your value is " + value, value );
}
} );
c.add( new FieldLabel(numberField, "NumberField"), new VerticalLayoutData(1,-1) );

// create another field
TextField textField = new TextField();
c.add( new FieldLabel(textField, "TextField"), new VerticalLayoutData(1,-1) );
RootPanel.get().add(c);
}

WesleyMoy
1 Mar 2012, 8:49 PM
I'm not noticing this on Beta 4 (http://www.sencha.com/forum/showthread.php?184556-Ext-GWT-3.0-Beta-4-Now-Available). Each time I hover the cursor over the error icon (when I am no longer focussed on the field), I see the correct value in the tooltip.

Try your test case with Beta 4 and see if that resolves the issue. If you still notice problems, post a reply with your browser, OS, and whether you noticed this problem in development mode, production mode, or both.