I have date field in my form I am working on, and when the date picker is used, it works fine with the date format as YYYYMMDD. However, when it is manually entered wrong, it only pops up the error message, but tabs to the next field. Is there a script that will set the focus back to the field, and only tabs out of it when the user input is incorrect. I wrote the below script, but it is not working, and I do not know why it is not.
Create a date() for parsing information.
var sDate = Date.rawValue;
var oDate = util.scand("yyyymmdd", sDate); // Store date values.
var nYear = oDate.getFullYear();
var nMonth = oDate.getMonth() + 1;
var nDay = oDate.getDate(); if(nDay > 31 || nDay < 1 || nMonth > 12 || nMonth < 1){ xfa.host.messageBox("Please enter the number using numerical characters only in the format YYYYMMDD"); xfa.host.setFocus("DateTimeField1"); }
Thanks
v/r
Tammy