I have a DataField with editable="true" and format mm/dd/yyyy. Then lets say user typed in month mm section 13 which is not correct. How can I validate it as well as dd section and yyyy section and show a pop up when it's incorrect?
Here is what happening when apply button was clicked:
var newDate:Date = dfDate.selectedDate;
var month:String = (newDate.month + 1) < 10 ? "0" + (newDate.month + 1).toString() : (newDate.month + 1).toString();
var date:String = newDate.date < 10 ? "0" + newDate.date.toString() : newDate.date.toString();
var year:Number = newDate.getFullYear();
var dateString:String = month + "/" + date + "/" + year;
Button section:
<mx:FormItem id="itemDate">
<mx:DateField id="dfDate" yearNavigationEnabled="true" editable="true"/>
</mx:FormItem>
You can use just a simple regular expression
And then use
.testfunction along with some formatting stuffWorked for me just fine and I think will work for others as well!
Here is code all together: