1 Reply Latest reply on Jan 28, 2011 2:17 AM by _spoboyle

    Flex Form Validation

    Mr Alec

      I'm currently using Flex Builder 3, since when I started this project I used FB3, so I continued to do so regardless of FB4 release.

       

      I'm currently wondering if there is any other way to validate users inputs other then putting it in as a form item, and calling them from AS3.

       

      I went through 8 pages and setup this form, each page has around 10 inputs, and I just can't find a way to do validating for each state to move on to the next since they aren't in a Form box.

       

      Is there another way to validate, I particularly want to use FB's validator class because it provides that red highlight and a hover-over tip.

       

      Thanks,

      Alec

        • 1. Re: Flex Form Validation
          _spoboyle Level 4

          sorry i do not have FB3 installed and i am fairly new to flex myself but does the follwoing not working in FB3?

          (compiled with Flex 3.5)

           

          <?xml version="1.0" encoding="utf-8"?>
          <!-- http://blog.flexexamples.com/2007/10/26/customizing-the-accordion-header-in-flex-3/ -->
          <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
                          layout="vertical"
                          verticalAlign="top"
                          backgroundColor="white">
             
              <mx:Script>
                  <![CDATA[
                      private function validate():void
                      {
                          stringValidator.validate();
                      }
                     
                  ]]>
              </mx:Script>
             
              <mx:StringValidator id="stringValidator"
                                  source="{input}"
                                  property="text"
                                  minLength="6"
                                  triggerEvent=""/>
             
              <mx:TextInput id="input"/>
              <mx:Button id="submit" click="validate()"/>
                                 
             
          </mx:Application>