lundi 19 décembre 2016

How would I check for a proper custom input of mm/dd/yyyy in actionscript 3?

What I mean is for ex. 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>

Aucun commentaire:

Enregistrer un commentaire