Highlighted

Prevent date entry from default value 01/01/XXXX when a year only.

Avatar

Guest

26-06-2008

I need a method to prevent the a date field from entering a default value when a user does not enter a full date. For instance if I have a display and vallidation pattern of mm/dd/yyyy and a user enters 2008 in the field, it will automatically format the field to 01/01/2008.



I need an error message or some sort of alert to notify the user that the date should be entered in the mm/dd/yyyy format. Currently my alert message is called when a date like 3/333 is entered or 333 or some other incorrect format.



I could really use the help as I am under a tight deadline.



Thanks,



Joe

Replies

Highlighted

Avatar

Guest

27-06-2008

There are many ways to validate a date, but it looks like you're looking for a quick way to ensure that the user has entered 10 characters. You could verify on exit that the entry is 10 characters and then post a message if it isn't (using JavaScript):



if (this.rawValue.length != 10){

xfa.host.messageBox("errorMessage","errorTitle",0,0);



}



You can also set the value back to null if the user entered less than 10 characters if you really want to get the point across.



If you're looking for something more extensive, let me know.



Good luck with your deadline.