Closed s-panferov closed 8 years ago
For setup one error message you can use https://github.com/bem/bem-forms/blob/master/common.blocks/form-field/_message/form-field_message.browser.js#L37
Method setErrors
must also be able to work with object because form-field
can work with many validations types https://github.com/bem/bem-forms/blob/master/desktop.bundles/index/index.bemjson.js#L29
Ex:
formField.setErrors({
required: String
});
After working with this library for a while, I think that
form-field
needs a method to set external errors. It is very useful in cases with external validation (e.g. on the server side) or complex business logic validation when some external data or another fields are involved.Example API: