Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Date field to only accept numbers

Avatar

Level 3

I am creating a LiveCycle form and I want the date field/numeric field to only accept number. I do not want the user to be able to type in special characters or letter. I want the format to be MM/DD/YYYY but no alpha or special characters. Is there a way to do that?

Thanks in advance,

Ife

1 Accepted Solution

Avatar

Correct answer by
Level 10

To restrict the characters a user can enter to 0-9 use this script in the fields change event.

if (!xfa.event.change.match(/[0-9]|/)) {

  xfa.event.change = "";

}

View solution in original post

2 Replies

Avatar

Correct answer by
Level 10

To restrict the characters a user can enter to 0-9 use this script in the fields change event.

if (!xfa.event.change.match(/[0-9]|/)) {

  xfa.event.change = "";

}