Cannot make allowBlank true visually in ExtJS

I have a text box:

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

I make it necessary when the checkbox is checked with

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

I turn red and it becomes necessary.

Then, when another checkbox is checked, I use this code

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

This is not required, but the red frame does not disappear. I need to click the box and another place to remove the red border.

+4
source share
1 answer

use clearInvalid in the field also to reset its invalidation style.

 Ext.getCmp('specialCode').allowBlank = true; Ext.getCmp('specialCode').clearInvalid(); 
+9
source

All Articles