简体   繁体   中英

Flash Builder: How to verify if the date has been selected in datechooser component?

I am trying to verify if the users select a date in my date chooser spark componet. I tried:

if(dateChooserBegin.selectedDate){
..........
}

I will get a run time null object error. I was wondering if anyone here know to do this. Thanks for the help.

You will probably need to extract the date from the CalendarLayoutChangeEvent event object that is raised on choosing a particular date. See the example on Flex livedocs (particularly the useDate event handler.

Best way I can think of is adding on to what dirkgently said. Set on onChange event on the dateChooser to change a global boolean value to true. Then in your if() check if the boolean is true. Only other method I can think of to ensure that ANY date is set is to use a selectedDate on the dateChooser itself, forcing a default date in there.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM