PDA

View Full Version : [2.1.3] Unable to use html entities in validaton error text of Fields



CrizztlCoder
5 Aug 2010, 12:26 AM
- 2.1.3
- Host mode and web mode
- Firefox 3.6.8 / IE7
- Operating System MS WinXP Pro SP3

When using a customized invalid-text on Fields, it is not possible to use html entities (like ü , ¶ ).
The markInvalid function of Field calls Format.htmlEncode() which replaces all occurences of & with &
Thus ü becomes ü and is not display as ü.


public class Test implements EntryPoint {
public void onModuleLoad() {
final TextField<String> text = new TextField<String>();

Validator val = new Validator() {
public String validate(Field<?> field, String value) {
if(text.getValue().length() > 10) {
return "&uuml;mlaut";
}
else {
return null;
}
}
};

text.setValidator(val);
RootPanel.get().add(text);
}
}

sven
5 Aug 2010, 2:38 AM
We cannot change the behaviour of that methodas of now as this would be a braking change. We can look into this for GXT3

As workaround you can run your page in UTF8 for example and directly return the "ü"