1 Reply Latest reply on Feb 25, 2010 8:59 AM by Gregory Lafrance

    Date Validation

    194642537 Level 1

      Hi All,



           I want to validate whether the date entered is in dd-mm-yyyy format. I dont want to use built in validators.

      Can anybody pleaseshare a working code or a link to help me



        • 1. Re: Date Validation
          Gregory Lafrance Level 6

          This should answer your question:


          <?xml version="1.0" encoding="utf-8"?>
          <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
                import mx.controls.Alert;
                private function checkInput():void{
                  if(txt.text.match(/\d\d-\d\d-\d\d\d\d/) != null){
                    mx.controls.Alert.show("Date format is correct.");
                    mx.controls.Alert.show("Date format is wrong.");
            <mx:TextInput id="txt"/>
            <mx:Button label="Validate Input" click="checkInput();"/>

          If this post answers your question or helps, please mark it as such.

          Greg Lafrance - Flex 2 and 3 ACE certified


          Flex / AIR Development, Training, and Support Services