Hi. I am sorta new at scripting. I want to validate a date entry in a text field. I've searched and found example scripts on how to do this, but when I code the script in the form, any text I enter in the field does not pass the edit, I always get the error message. Can anyone point out the (probably) obvious oversight I am making? Here is the simple code:
----------
form1.#subform[0].TextField1::exit - (JavaScript, client)
var dateStr = this.rawValue;
var regExp = /^\d{1,2}\/\d{1,2}\/d{4}$/;
if (!regExp.test(dateStr)) {
xfa.host.messageBox("Please enter the date in the format MM/DD/YYYY.");
}
---------
If I enter an "x" in the field I get the message box error.
If I enter any valid date in mm/dd/yyyy format I get the same message.
I have am using LiveCycle Designer ES v8, but I have tried with the prior version with the same result.
TIA,
Gary, NJ
var regExp = /^\d{1,2}\/\d{1,2}\/\d{4}$/;
the script works just fine.