4 Replies Latest reply on Sep 28, 2009 12:35 PM by paul.williams

    Validation errors exiting from current process.


      Hi All,


         I'm having below code


         <mx:Canvas height="100%" width="100%">
           <mx:VBox width="100%" height="100%">
                   <mx:Label text="Consumer Information: " fontSize="12" fontWeight="bold" color="#34B05D"/>
               <mx:HBox width="100%">
                   <mx:Label  width="25%" text="City: " fontWeight="normal"/>
                   <mx:TextInput width="25%" id="city" editable="{pageModeStat}" />
                   <mx:Label  width="25%" text="State:" fontWeight="normal"/>
                   <mx:ComboBox width="25%" id="state" enabled="{pageModeStat}" />
               <mx:HBox width="100%">
                   <mx:Label  width="25%" text="Zipcode: " fontWeight="normal"/>
                   <mx:TextInput width="25%" id="zip" editable="{pageModeStat}" />   
                   <mx:Spacer width="25%" />                
                   <mx:Spacer width="25%" />        


                <mx:HBox width="100%" horizontalAlign="center">
                   <mx:Button label="{buttonText}" id="submit_search" click="submit(event)"  />



           <mx:ZipCodeValidator id="zipCodeValidator" triggerEvent="click" source="{zip}" property="text" valid="zipCodeValidator_valid(event);" invalid="zipCodeValidator_invalid(event);" />




         I'm having following method in <mx:Script>



         private function zipCodeValidator_valid(evt:ValidationResultEvent):Boolean {
              return false;


          private function zipCodeValidator_invalid(evt:ValidationResultEvent):Boolean {
              return true;


          public function submit(evt:Event):void{
                if (zipCodeValidator.validate(zip.text))


                myViewStack.selectedChild = Confirmation;
          }//End of submit



         When user submit this form without giving any zip code/invalid zip code, I'd like to validate this in submit method and need to redisplay the same page if it is having any errors. When I give valid zip code it is still not displaying 'Confirmation' page.


         Can anyone let me know how to use zip code validation in this scenario.


         Thanks in advance.