必填项的label后面加星号

必填项的label后面加星号

Ext.form.TextField.override({  

                initComponent: Ext.form.TextField.prototype.initComponent.createInterceptor(function(){  

                    if (this.allowBlank === false && this.fieldLabel) {  

                        this.fieldLabel += '<font color=red>*</font>';  

                    }  

                })  

            });  

所有的输入项如果配置了allowBlack 为false,它的label后面就都会有红星号了,方便日后统一修改。

这段代码加在appbase.js的最后,label里不需要再写 <font color=\'red\'>*</font>
posted @ 2011-04-06 10:50  meetrice  阅读(2336)  评论(0编辑  收藏  举报