extjs - Change color of the field when condition is satisfied -


for example, have textfield input type 'email'. have set default color of field pink. if input in proper email format, want textfield's color changed white. how do that?

the eg code:

xtype: 'textfield', labelwidth : 250, fieldstyle: 'background-color : #f5a9a9', vtype :  'email', fieldlabel: 'email address' 

in case first need check weather input value email or not. using var fieldvalidation = ext.form.field.vtypes.email(val); if fieldvalidation true input value email. once verified input value change our background color. this.setfieldstyle("background-color : #ffffff")

your code :

    {         xtype: 'textfield',          fieldstyle: 'background-color : #f5a9a9',         vtype :  'email',         fieldlabel: 'email address',         validator : function(val){         var fieldvalidation =  ext.form.field.vtypes.email(val);            if(fieldvalidation == true){               this.setfieldstyle("background-color : #ffffff");            }         }     } 

i created fiddle you. please have look. working fiddle.

also attaching doc of vtype understand properly. doc


Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

python - Error: Unresolved reference 'selenium' What is the reason? -

php - Need to store a large amount of data in session with CI 3 but on storing large data in session it is itself destorying automatically -