Date format (mm/dd/yyyy) for LiveCycle Designer form




I am working on the 35 pages Dynamic LiveCycle form where I am having many date fields (DOB, DOO and DOJ).

Sometimes, the user enters the date manually instead selecting the dropdown. Suppose, if they start entering the value manually should get a popup showing "Please use the Dropdown instead of manually entering the date." So, it doesn't allow the user to enter the value manually.

Once the user selected the date from the dropdown, the format of the date should be (mm/dd/yyyy).

Can anyone help me with the JavaScript code?

Thanks in advance.

View Entire Topic



Here is how I solved it on a form I had created. I had a hidden field and on the calculate event following triggered. It may have also worked on an exit event. I do not recall why I did not do it on an exit event

var myRegExp = /[0-1][0-9]\/[0-3][0-9]\/\d{4}/; // Created a regular expression for the date format

var myText = ExecFromDate.rawValue;

if(ExecFromDate.rawValue == null){

ExecFromDate.rawValue = null;



if(myRegExp.test(myText)== false){"You have entered an incorrect date format. Please use MM/DD/YYYY", "Date error", 3, 0);"ExecFromDate") //sets focus to the field.

ExecFromDate.rawValue = "" //resets the field to null if the patter is wrong.