Closed qfox closed 9 years ago
I don't see problems in current variant. You can build assets with all need deps on client. In this two variants you should do this. Why you want control now?)
@verybigman To have a light form variant ;-)
This resolve #5
And #14
module.require(['validate', 'validate_numbers'], function(Validate, numbers) {
// ...
var validate = new Validate();
validate.push(numbers(‘Что-то не так’));
validate.push(function (val) {
return false;
}, ['Ошибка 1', 'Ошибка 2']);
// ...
field.checkValidate =
if (validate.run()) { // есть ошибки
this.setMessage(validate.getErrors().join('')); // выводим массив с ошибками
}
We using it as a mix for
input
(or similar) blocks right now:There is a lot of data that we should pass for each field and I really want to simplify it if possible.
Any guesses will help a lot.
The one that placed on the top of my mind probably have troubles with theme deps:
control_validation_numbers
will requirevalidation_numbers
block,form__control_type_text
will requireinput
andinput_type_text
, andform__control_theme_islands
will requireinput_theme_islands
. Right? Also it can internally regenerate the rest of needed bemjson by BH/BEMHTML but I'm afraid of missing deps here and need review.I think that's all
validation
block needed to return some validation result. All other work with form should be placed inform_validation
.