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 -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -