开发者

Can't make allowBlank true visually in ExtJS

开发者 https://www.devze.com 2023-04-04 17:45 出处:网络
I have textfield: { xtype : \'textfield\', id: \'specialCode\', allowBlank: true, fieldLabel : \'Special Code\',

I have textfield:

{
                xtype : 'textfield',
                id: 'specialCode',
                allowBlank: true,
                fieldLabel : 'Special Code',
                name : 'specialCode'
            }

I do 开发者_Go百科make it required when a checkbox is checked with

Ext.getCmp('specialCode').allowBlank = false;
Ext.getCmp('specialCode').validateValue(Ext.getCmp('specialCode').getValue());

I becomes red and it becomes required.

Then when another checkbox is cheked I use this code

Ext.getCmp('specialCode').allowBlank = true;

It becomes not required but the red border does not go away. I need to click the field and some other place in order to remove the red border.


use clearInvalid on the field too to reset it's invalidation style.

Ext.getCmp('specialCode').allowBlank = true;
Ext.getCmp('specialCode').clearInvalid();
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号