I've spent a couple days on this issue and I've come to no resolution.
I've spent considerable time in the debugger tracing things down and
cannot see where the problem is. Here's the use case:

I have a phone number field. On fousOut, I validate the field and if
it is a valid phone number I apply a phone formatter to it.

On initial pass the formatter works as expected. However, if the user
again focuses on the phone number field, once they focusOut the phone
number is removed.

Debug info shows the formatter stating the phone number is invalid. It
also shows the text value is valid. Here's example code:

<mx:TextInput id="ti_CellPhone" focusOut="validateAsPhone(event);"/>

private function validateAsPhone(evt:FocusEvent):void
{
   blah blah
   
   if(valid)
   {
        var phoneFormatter:PhoneFormatter = new PhoneFormatter();
                                        
        phoneFormatter.validPatternChars = "#-()";
        phoneFormatter.formatString = "###-###-####";
        evt.currentTarget.text =
phoneFormatter.format(evt.currentTarget.text);
   }

}

Reply via email to