javascript - How to mark required field with asterisk in Ext JS textfield labels -
i need add red asteriks multiple form fields allowblank property set false in screens extend screen below. i've tried solution here: extjs 4 - mark red asterisk on required field isn't working. there way can add functionality in initcomponent function?
ext.define('app.view.ux.visual.screen.uxclassicscreen', { extend: 'ext.form.panel', alias: 'widget.uxclassicscreen', config: { layout: 'vbox' }, initcomponent: function(){ var viewmodel = this.getviewmodel(), controller = this.getcontroller(); if(viewmodel != null && controller != null){ viewmodel.set('iskiosk', controller.iskiosk()); } this.callparent(); } });
for adding behavior fields, can override ext.form.field.base
, example:
ext.define('myapp.overrides.form.field.base', { override: 'ext.form.field.base', initlabelable: function () { this.callparent(arguments); if (this.fieldlabel && this.alllowblank === false) { this.labelseparator += '<span class="mandatory">*</span>'; } } });
Comments
Post a Comment