Avatar

Correct answer by
Level 10

This needs to be tested THOROUGHLY. My testing was very limited. Given a two digit year the validation checks for two digits (\d\d) only.

// form1.page1.subform1.tf1::exit - (JavaScript, client)

if (!(this.isNull)) {

  var regEx = /^(0[1-9]|[12][0-9]|3[01])(0[1-9]|1[012])\d\d$/;

  var str = this.rawValue;

  str = str.substring(0,6);

  if (regEx.test(str)) {

    xfa.host.messageBox("Valid mmddyy");

  }

  else {

    xfa.host.messageBox("Invalid mmddyy");

  }

}

Steve

View solution in original post