PDA

View Full Version : Error tips localization



dstrr
1 Mar 2011, 2:18 AM
When you use localization and user error messages for composite fields, error message is build with template %fieldname% + ':' + %message%

it is generated by code


Ext.form.CompositeField = Ext.extend(Ext.form.Field, {
...
onFieldMarkInvalid: function(field, message) {
var name = field.getName(),
error = {field: name, error: message};

this.fieldErrors.replace(name, error);

field.el.addClass(field.invalidClass);
}
...
});and it looks good until localization is used.

With assumption that fieldLabel contains localized value such patch is suggested:


Ext.form.CompositeField = Ext.extend(Ext.form.Field, {
...
onFieldMarkInvalid: function(field, message) {
var name = field.fieldLabel || field.getName(),
error = {field: name, error: message};

this.fieldErrors.replace(name, error);

field.el.addClass(field.invalidClass);
}
...
});