Looks like we can't reproduce the issue or there's a problem in the test case provided.
-
Sencha User
Calling isValid() on a Model throws an error in Modern Production build
Code:
//The Model
Ext.define(MyApp.model.UserLogin', {
extend: 'Ext.data.Model',
requires: [],
fields: [
{name: 'userId', type: 'string'},
{name: 'password', type: 'string'}
],
validators: {
userId: [
{type: 'email', message: "Wrong Email Format"},
{type: 'presence'}
],
password: [
{type: 'length', min: 4},
{type: 'presence'}
]
},
proxy: {
...
}
});
Code:
//In the app
var user = Ext.create('MyApp.model.UserLogin', {
userId: fields.user,
password: fields.password
});
if (user.isValid()) { *****
...
}
else {
...
}
***** This line throws "Uncaught TypeError: c is not a function"
I made sure that userId and password had valid values.
-
Sencha User
Solution found:
It seems that I have to require ['Ext.data.validator.Email', 'Ext.data.validator.Presence', 'Ext.data.validator.Length'] when using the testing/production builds.