Hello, I was wondering if anyone knows how to require a numeric field to be 9 digits, and only 9 digits without any commas or leading zeros. I tried using num{999999999} in the display field but that gives me leading zeros. I want to make the user input only 9 digits or else they cannot submit the form, or an error message pops up, or they cannot go to the next field or something. Any help would be greatly appreciated, I'm new to these programs!
Solved! Go to Solution.
Views
Replies
Total Likes
You can use the following display pattern to remove the leading zeros.
num{zzzzzzzzz}
Place the following code in the change event of the NumericField to restrict the input upto 9 digits with JavaScript as language.
if(xfa.event.newText.length >9)xfa.event.change = "";
Place the following code in the Exit event of the field to check the length with JavaScript as language.
var intValue = this.rawValue.toString();
if(intValue.length<9){
xfa.host.messageBox("You need to enter 9 digits");
xfa.host.setFocus(this.somExpression);
}
Thanks
Srini
Views
Replies
Total Likes
You can use the following display pattern to remove the leading zeros.
num{zzzzzzzzz}
Place the following code in the change event of the NumericField to restrict the input upto 9 digits with JavaScript as language.
if(xfa.event.newText.length >9)xfa.event.change = "";
Place the following code in the Exit event of the field to check the length with JavaScript as language.
var intValue = this.rawValue.toString();
if(intValue.length<9){
xfa.host.messageBox("You need to enter 9 digits");
xfa.host.setFocus(this.somExpression);
}
Thanks
Srini
Views
Replies
Total Likes
FANTASTIC! Thank you so much, you are amazing.
Views
Replies
Total Likes
Srini! I need your help again. How can I do the above, but now WITH the capacity for leading zeroes?
Views
Replies
Total Likes
Correction, here are the things I need out of this numeric field:
-only 9 digits, error message if they do not iput total 9 digits and it not allowing more than 9
-allowing leading zeroes, but not autofilling the leading zeroes if they don't input enough. i used your above code, and put num{999999999} in the display pattern but that autofilled zeroes
-no commas in between numbers
THANK YOU!
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies