Question

My scenario,

    <fx:Declarations>
    <mx:DateValidator id="dobValidator"
                      source="{dobInput}"
                      property="text"
                      requiredFieldError="required"
                      />
    </fx:Declarations>

     <s:FormItem id="dobLabel" label="Date Of Birth">
        <mx:DateField id="dobInput" 
                      restrict="0-9 /" 
                      editable="true"
                      yearNavigationEnabled="true"
                      formatString="YYYY/MM/DD"
                      focusOut="dobValidator.validate()"/>
    </s:FormItem>

Here, there is no effect for formatString. If I select or enter date value like this "1990/12/12", it will display the error like "Type the date in the format MM/DD/YYYY". I don't know what is my mistake? Anybody can help me?

Was it helpful?

Solution

You need to specify inputFormat in DateValidator instance.

<mx:DateValidator id="dobValidator"
                  source="{dobInput}"
                  property="text"
                  requiredFieldError="required"
                  inputFormat="YYYY/MM/DD"
                  />
</fx:Declarations>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top