我有文字字段:
{
xtype : 'textfield',
id: 'specialCode',
allowBlank: true,
fieldLabel : 'Special Code',
name : 'specialCode'
}
Run Code Online (Sandbox Code Playgroud)
当选中复选框时,我确实需要它
Ext.getCmp('specialCode').allowBlank = false;
Ext.getCmp('specialCode').validateValue(Ext.getCmp('specialCode').getValue());
Run Code Online (Sandbox Code Playgroud)
我变红了,变得需要.
然后,当另一个复选框被解雇时,我使用此代码
Ext.getCmp('specialCode').allowBlank = true;
Run Code Online (Sandbox Code Playgroud)
它不是必需的,但红色边框不会消失.我需要单击该字段和其他一些位置以删除红色边框.
clearInvalid在场上使用也可以重置它的失效风格.
Ext.getCmp('specialCode').allowBlank = true;
Ext.getCmp('specialCode').clearInvalid();
Run Code Online (Sandbox Code Playgroud)