Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

How to make text field only accpet digits?

Level 1
Level 1

Hello everyone

I wann know how to make a text field only accpet digits (0,1,2 ...9)? In Acrobat, it's very easy to set, but in LiveCycle, looks it needs some custom JavaScript, can anyone please provide help?

The following codes can't work in LiveCycle, how to make it work?

    event.rc = !isNaN(event.change) || event.change == "." || (event.change == "-" && event.selStart == 0);


0 Replies
Level 10
Level 10

Regular expressions are a good option. The following uses \D to match any character that is not a digit.

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

if (!(this.isNull)) {

  var tf1 = this.rawValue;

  var regExp = /\D/;

  if (regExp.test(tf1)) {"tf1 must be numeric");




Level 1
Level 1

Thanks Steve, your codes are what I want.