How to extend TextField to access model in Ember.js -
i writing form post in ember.js.
- attr binding , condition support boolean value other expression.
- action didn't take arguments.
i want error show when input focus , input valid.
in simple way, should in focus-in , focus-out property. many field, have write 2 action each input.
i want write reusable view that, don't know how change model's value in view.
any 1 know that?
erp.fromfieldview = ember.textfield.extend({ attributebindings: ['type', 'value', 'size', 'pattern', 'name', 'min', 'max', 'accept', 'autocomplete', 'autosave', 'formaction', 'formenctype', 'formmethod', 'formnovalidate', 'formtarget', 'height', 'inputmode', 'list', 'multiple', 'pattern', 'step', 'width', 'error', 'regex'], name: 'default', error: '', regex: '^.+$', isvalid: true, valuechanged: function () { re = new regexp(this.get('regex'), 'g'); this.set('error', !re.test(this.get('value'))); }.observes('value'), focusin: function (event) { this._super(event); if (this.get('value') == undefined) { this.set('error', true); } }, focusout: function (event) { this._super(event); this.set('error', false); } }); ember.handlebars.helper('form-field', erp.fromfieldview);
Comments
Post a Comment