Thank you for reporting this bug. We will make it our priority to review this report.
Model validation does not react to local settings
Model validation does not react to local settings
Ext version tested: Browser versions tested against:
- IE8
- IE9
- FF (firebug installed)
Description:- If using model validation on number fields, validation fails with a "must be numeric" message, due to usage of different decimal separators. Whereas the form field uses "," as separator (e.g. in germany), the model validates against ".".
Steps to reproduce the problem:- Create model with float field with a validator type range
- create form with number field
- create viewModel and bind the field
- set modelValidation: true on the field
- set locale to a country with decimal "," (or apply different separator)
The result that was expected:- valid form for input "123,45"
The result that occurs instead:- validation error "must be numeric"
Code to reproduce the error:
Code:
Ext.onReady(function() {
Ext.apply(Ext.util.Format, {
thousandSeparator: '.',
decimalSeparator: ',',
currencySign: '\u20ac',
// German Euro
dateFormat: 'd.m.Y'
});
});
Ext.define('Model', {
extend: 'Ext.data.Model',
fields: [{
name: 'num',
type: 'float',
validators: [{
type: 'range',
min: 10,
max: 1000
}]
}]
});
var temp = Ext.create('Model', {num: 47.44});
Ext.define('ViewModel', {
extend: 'Ext.app.ViewModel',
alias: 'viewmodel.test',
data: {
temp: temp
}
});
Ext.application({
name : 'Format with model validation',
launch : function () {
Ext.create('Ext.container.Viewport', {
layout : 'fit',
items: {
xtype: 'form',
modelValidation: true,
viewModel: {
type: 'test'
},
items: [
{name: 'num', xtype: 'numberfield', bind: '{temp.num}'}
]
}
});
}
});
Model validation does not react to local settings
Aucun commentaire:
Enregistrer un commentaire