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?
You need to specify inputFormat
in DateValidator
instance.
<mx:DateValidator id="dobValidator"
source="{dobInput}"
property="text"
requiredFieldError="required"
inputFormat="YYYY/MM/DD"
/>
</fx:Declarations>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.