Avatar

Level 10

You can do this in this way.

if (this.formattedValue === this.rawValue)

{

xfa.host.messageBox("Wrong Date Format");

xfa.host.setFocus(this);

this.rawValue = "";

}

You also can define a validation pattern in your date field, then you don't need a script.