Apache – Flex: Display Validator Error Message

apache-flexvalidation

In flex, when I put the mouse over a field that is not valid, a red popup appears
which indicate the error message. By default, it's rounded by red.

Is it possible to display the red popup by default without mouse over it?
Because sometimes the red box is not clear enough and we have impression that the program is
stuck

Best Answer

I had a similar issue and I handled it like this.

on the validators I add valid and invalid functions which then changed the background color of the text box or whatever form elements you want. Here is a snippet of code:

<mx:StringValidator valid="handleValid(event)" invalid="handleValid(event)"/>


private function handleValid(event:ValidationResultEvent):void{
  if(event.type== ValidationResultEvent.VALID){
    TextInput(event.target.source).styleName = "validTextStyle";
  }
  else{
    TextInput(event.target.source).styleName = "inValidTextStyle";
  }
}

Then I had styles the turned the background color of the textInput Red for invalid and white for valid