combo box date validation

Ask a Question related to Macromedia Flex General Discussion, Design and Development.

  1. #1

    Default combo box date validation

    Hi,
    As per our requirement, we need to put combo boxess for date input. we are
    giving the user to input as dd month year format from the given combos. Can you
    give me idea how to validate the date(feb 31 ..) from the given inputs. If it
    is textbox, it will be ok. but our need is very particular about, comboboxes.

    Thanks


    j2eesatish Guest

  2. Similar Questions and Discussions

    1. [PHP] Date Validation, Kinda'
      Now that I'm thinking about it, what is your goal with this? Is it to make sure the date entered is within a certain range when compared to another...
    2. Date Validation
      I'm trying to find some Coldfusion code that will allow me to validate a date to make sure that it's in MM/DD/YY format and is actually a valid...
    3. Date Range Validation
      Hello; CL_FRST (08/10/2004) and CL_LST (05/24/2005) holds the beginning and ending date of school calendar which is also prepopulated for every...
    4. Date Validation, Kinda'
      Howdy, Has anyone written any date validation function or sequence. I have looked around, but haven't found anything. I am cobbling togather...
    5. date validation?
      How to write an IsDate function that actually checks for a particular date format? Using try-catch on Convert.ToDateTime(sDate) doesn't catch...
  3. #2

    Default Re: combo box date validation

    A DateValidator can validate against comboboxes as you describe. Here is an
    example. With the following code, try entering an invalid date such as Feb.
    31, and then pressing the Submit button; you will see a red border around the
    Day field, and when you hover over it, you will see text that says, "Enter a
    valid day for the month."


    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
    creationComplete="init()">
    <mx:HBox>
    <mx:ComboBox id="day" prompt="day" rowCount="31" dataProvider="{days}" />
    <mx:ComboBox id="month" prompt="month" rowCount="12" dataProvider="{months}" />
    <mx:ComboBox id="year" prompt="year" rowCount="20" dataProvider="{years}" />
    <mx:Button label="Submit" id="submit" />
    </mx:HBox>

    <mx:DateValidator
    daySource="{day}" dayProperty="selectedItem"
    monthSource="{month}" monthProperty="selectedItem"
    yearSource="{year}" yearProperty="selectedItem"
    trigger="{submit}" triggerEvent="click"
    />

    <mx:Array id="years" />
    <mx:Array id="days" />
    <mx:Array id="months" />

    <mx:Script>
    <![CDATA[
    private function init():void
    {
    var i:int;
    for (i = 1900; i <= 2006; ++i)
    years.push(i);
    for (i = 1; i <= 31; ++i)
    days.push(i);
    for (i = 1; i <= 12; ++i)
    months.push(i);
    }
    ]]>
    </mx:Script>
    </mx:Application>
    Mike Morearty (Adobe) Guest

  4. #3

    Default Re: combo box date validation

    Thanks a lot!
    The code looks fine. It will bbe exactly suited for our requirement. But, i
    am getting some errors while executing the code. here the given exampel include
    the line <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
    creationComplete="init()">.
    but our application is <mx:Application
    xmlns:mx="http://www.macromedia.com/2003/mxml" initialize="loadme()">

    Will this exaple will not suite for the macromedia mxml form? i ve change as
    adobe. but the application is not able to recognize this!. Can you give me some
    help on this!


    Thanks


    j2eesatish Guest

  5. #4

    Default Re: combo box date validation

    You must be running version 1.5.

    There is enfough difference between the tow to make reverse migration very
    difficult. Using the docs and this example, though, you might be able to see
    what is needed.

    If you indicate the Flex version you are using in you post, it will save
    everyong a lot of time.

    Tracy

    ntsiii Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139