Validation must pass twice to clear errorColor?


i using external css file style app. in specify custom errorcolor property textinput controls.

 

this stringvalidator placed on textinput:

<mx:stringvalidator id="validatorusername"
        source="{textinputusername}"
        property="text"
        required="true"
        minlength="4" maxlength="25" 
        tooshorterror="your username must @ least 4 characters long."
        toolongerror="your username must less 25 characters long."
        trigger="{textinputusername}" triggerevent="valuecommit"
        valid="formatcontrolerrorstatus(textinputusername,0)"
        invalid="formatcontrolerrorstatus(textinputusername,1)"/>

 

the stringvalidator's valid , invalid events call function carry out further commands. want invalid field boldy marked, have function thicken border , set background color orange. once validates, returns control's formatting default.

 

public function formatcontrolerrorstatus(thecontrol:object,iserror:number):void
    {//valid/invalid trigger must pass name of target control , 0 no error, 1 error
    if(iserror==1)
        {
        thecontrol.setstyle("bordercolor","#ff4b00");
        thecontrol.setstyle("borderthickness",2);
        thecontrol.setstyle("backgroundcolor","#ff4b00");
        thecontrol.setstyle("backgroundalpha",.4);
        }
    else if (iserror==0)
        {
        thecontrol.setstyle("bordercolor","#7d6441");
        thecontrol.setstyle("borderthickness",1);
        thecontrol.setstyle("backgroundcolor","#ffffff");
        thecontrol.setstyle("backgroundalpha",.75);

        }
    }

 

here problem: when stringvalidator's "valid" event fired, code in formatcontrolerrorstatus completed successfully, border of textinput remains errorcolor color rather returning default color.  if go field , exit again without changing value, errorcolor border disappears , replaced standard border. why field have pass validation twice reset border color?

it's getting stranger now. went css file , removed statement errorcolor on textinputs.

 

however, still turns textinput border old customized color upon invalid entry, , odd behavior described in original post still remains.

 

i tried setting errorcolor same default bordercolor, , after border still turns orange. ?!?!

 

anyone have ideas on this?

 

thanks.

paul



More discussions in Flex (Read Only)


adobe

Comments

Popular posts from this blog

Flip address is out of range arduino uno r3

Arduino Uno not uploading

Indesign and MathType fonts