- Mark as New
- Follow
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report
I played with the regular expression. It is not perfect but should provide help:
var myRegExp = /[0-1][0-9]+Y [0-1][0-9]+M [0-3][0-9]+D/; // Created a regular expression. This will only allow 2 digits for the year with // the "Y" for year, 2 for month with an "M" 2 for days with a "D". This does not // restrict an incorrect entry for example if the user puts in 14 months it will //allow it.
var myText = ExecFromDate.rawValue;
if(ExecFromDate.rawValue == null){
ExecFromDate.rawValue = null;
}
else
if(myRegExp.test(myText)== false){
xfa.host.messageBox("You have entered an incorrect Years Months and Days format. Please see sample: 12Y 11M 09D", "Date error", 3, 0);
xfa.host.setFocus("ExecFromDate")
ExecFromDate.rawValue = "false"
}