Open
Description
I've read the following issue: #166 and I'm wondering how we can enforce type validation (using is module or node-validator).
If you submit an object to a string field, it is viewed as valid ("[Object object]"
). Of course, I don't think it is the desired behaviour. What do you think about it?
Or maybe providing a generic field and we add this kind of validation:
exports.typeValidator = function (type, message) {
if(!is.fn(is[type])) {
throw new TypeError('this type is not defined');
}
var msg = message || 'Please enter a valid value';
return function (form, field, callback) {
if (is[type](field.data)) {
callback();
} else {
callback(msg);
}
};
};
Metadata
Metadata
Assignees
Labels
No labels