Flex DateField 使用 Editable = True 验证日期 [英] Flex DateField validate date with Editable = True

查看:20
本文介绍了Flex DateField 使用 Editable = True 验证日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个 Editable = true 的 Datefield 组件

We have a Datefield component with Editable = true

<mx:DateField id="startDate"  
                                  width="120"
                                  editable="true"
                                  formatString="MM/DD/YYYY"
                                  selectableRange="{{rangeStart : new Date(2010,0,1), rangeEnd : new Date()}}"
                                  showToday="true"
                                  labelFunction="formatDate" 
                                  restrict="[0-9] '\/'" change="startDate_clickHandler(event)"
                                  yearNavigationEnabled="true" 
                                  text="{}" tabIndex="15" />

日历拥有我们想要的一切(只能选择 01/01/2010 之后的有效日期).现在的问题是,如果用户输入 (Editable = true) 无效日期或任何日期 <;2010 年 1 月 1 日,我如何验证该日期并显示警告,指出日期无效.请对此提供任何帮助,我们将不胜感激.

The Calendar has everything we want (able to choose a valid date only after 01/01/2010). Now the issue is that if the user enters (Editable = true) an invalid date or any date < 01/01/2010, how can i validate that and show an alert saying that the date is invalid. Please any help on this would be appreciated.

谢谢

苦涩

推荐答案

DateField 组件有一个您可以收听的 valueCommit 事件.因此,您可以将处理程序附加到该事件并根据需要进行验证.

The DateField component has a valueCommit event that you can listen to. So you can attach a handler to that event and do the validation as required.

这篇关于Flex DateField 使用 Editable = True 验证日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆