We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Now:
_onSubmit : function(e) { e.preventDefault(); this._emit('submit', this.getVal()); },
With validate by default:
_onSubmit: function(e, data) { e.preventDefault(); this.validate().then(fieldsStatuses => { if (this.checkFields(fieldsStatuses)) { this._emit('submit', this.getVal()); } else { this.getInvalidFields().then(invalidFields => { invalidFields[0].getControl().setMod('focused'); }); } }); }
or add new event success, or data
success
data
The text was updated successfully, but these errors were encountered:
in form.browser.js
_onSubmit: function(e, data) { e.preventDefault(); this._emit('submit', this.getVal()); this.validate().then(fieldsStatuses => { if (this.checkFields(fieldsStatuses)) { this._emit('success', this.getVal()); } else { this.getInvalidFields().then(invalidFields => { this._emit('error', this.getVal()); invalidFields[0].getControl().setMod('focused'); }); } }); }
in user block:
modules.define('form-contacts', ['i-bem-dom', 'form', 'store-auth'], function(provide, bemDom, Form, auth) { provide(bemDom.declBlock(this.name, /** @lends app.prototype */{ onSetMod: { js: { inited: function() { this._form = this.findChildBlock(Form); this._form._events().on('success', this._onFormSuccess, this); } } }, _onFormSuccess: function(e, data) { console.log(data); } })); });
or
/** * @module app */ modules.define('form-login', ['i-bem-dom', 'form', 'jquery', 'store-auth'], function(provide, bemDom, Form, $, auth) { provide(bemDom.declBlock(this.name, /** @lends app.prototype */{ onSetMod: { js: { inited: function() { this._form = this.findChildBlock(Form); this._form._events().on('success', (e, data) => auth.login(data)); } } } })); });
Very simple in use 👍
Sorry, something went wrong.
No branches or pull requests
Now:
With validate by default:
or add new event
success
, ordata
The text was updated successfully, but these errors were encountered: