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?
if(!event.willCommit)
event.rc = !isNaN(event.change) || event.change == "." || (event.change == "-" && event.selStart == 0);
Thanks
Views
Replies
Total Likes
Why not just use a numeric field?
Views
Replies
Total Likes
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)) {
xfa.host.messageBox("tf1 must be numeric");
}
}
Steve
Thanks Steve, your codes are what I want.
Views
Replies
Total Likes