Skip to main content
Inspiring
May 5, 2019
Answered

Help with implementing restrictions to required numeric fields on a form

  • May 5, 2019
  • 1 reply
  • 2043 views

Hi,

I need some help with putting restrictions on two fields - a policy # and a loan #. They'll both be numeric only in any variety of combination, policy # containing only 13 digits, while the loan # has no limit. I want both fields to allow only numeric characters, and prompt a warning message if they're not filled out correctly. I attempted some script to do this but it didn't go well Any help is greatly appreciated!

Thanks,

Valerie

This topic has been closed for replies.
Correct answer try67

Hmm. So it's set a character of limit of 13 (yay), no alpha (yay again), but when I press tab to proceed to the next field, the numbers I entered are removed, and then to move onto another field I must press tab again. No alert pops up about 13 digits, and the numbers just disappear. I must be doing something wrong? I did the prior custom keystroke script, limit of 13, and added your new validation script...


Are you entering a 13-digit value? If so, it should work.

And no, I didn't add an error message, but that can be easily done, by adding this line to the end of the validation script:

if (!event.rc) app.alert("Error! You must enter a 13-digit number.");

1 reply

try67
Braniac
May 5, 2019

Do you want to limit what the user can enter, or to validate the value when they exit the field, and only allow it if it adheres to these rules?

Inspiring
May 5, 2019

I want to limit each field to numeric characters, with the policy# only allowing 13 digits, no more no less. Because both the policy and loan number can be any combination of numbers, I don't know how we could introduce validation, but then again i only know the very basics of creating forms; these validating things are not my cup of tea. The loan number shouldn't be limited to any certain number of characters. Thanks!

try67
try67Correct answer
Braniac
May 12, 2019

Hmm. So it's set a character of limit of 13 (yay), no alpha (yay again), but when I press tab to proceed to the next field, the numbers I entered are removed, and then to move onto another field I must press tab again. No alert pops up about 13 digits, and the numbers just disappear. I must be doing something wrong? I did the prior custom keystroke script, limit of 13, and added your new validation script...


Are you entering a 13-digit value? If so, it should work.

And no, I didn't add an error message, but that can be easily done, by adding this line to the end of the validation script:

if (!event.rc) app.alert("Error! You must enter a 13-digit number.");