Not sure what your question is. Do you have some code?
Is this ExtJS code not working?
http://docs.sencha.com/extjs/6.5.2/clas ... od-isValid
What do you mean by enforce? When the model is configured correctly the isValid method should return false in case validation fails.
Is this ExtJS code not working?
Ext.define('User', {
extend: 'Ext.data.Model',
fields: [
{ name: 'name', type: 'string' },
{ name: 'age', type: 'int' },
{ name: 'phone', type: 'string' },
{ name: 'gender', type: 'string' },
{ name: 'username', type: 'string' },
{ name: 'alive', type: 'boolean', defaultValue: true }
],
validators: {
age: 'presence',
name: { type: 'length', min: 2 },
gender: { type: 'inclusion', list: ['Male', 'Female'] },
username: [
{ type: 'exclusion', list: ['Admin', 'Operator'] },
{ type: 'format', matcher: /([a-z]+)[0-9]{2,3}/i }
]
}
});
What do you mean by enforce? When the model is configured correctly the isValid method should return false in case validation fails.