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
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
North America
Europe, Middle East and Africa
Asia Pacific