0

I want to change the background color of a textbox as an indicator that it is being validated.

<ui:style>     

   .textBoxColor
   {
        background-color: #FF6EB4;  
}
</ui:style>

and then

if(firstName.equals(""))
    {

        txtFirstName.setStyleName("textBoxColor");
    }

This is however not giving the expected result.

How can I achieve the change in color?

Kind regards

Arianule
  • 8,811
  • 45
  • 116
  • 174
  • possible duplicate of [setting CSS style Uibinder Gwt](http://stackoverflow.com/questions/10896480/setting-css-style-uibinder-gwt) – Jeremy Jun 07 '12 at 21:51

1 Answers1

1

If I'm not mistaken, css names declared in UIBinder are converted on compilation - so setting the style to textBoxColor won't work, simply because there won't be a style with that name.

If you add that to an external css file (maybe with a more descriptive name, say... .validated), setStyleName() will work.

Marcelo
  • 4,580
  • 7
  • 29
  • 46