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

SOLVED

Specify a range for a Numeric Field

efmbman
Level 1
Level 1

I have a numeric field in a form. I want to restrict the valid entries to 0 - 30 only. I have tried using some script tips I found online, but all I get are errors. Is there anyway to do this without using a script? If script is the only way, I would certainly appreciate help. Thanks in advance!

- Rick

1 Accepted Solution
Jono_Moore
Correct answer by
Level 10
Level 10

On the Exit event of the field put you can put something like the following (make sure the Script Editor is set to JavaScript):

if (this.rawValue < 0 || this.rawValue > 30) {

          xfa.host.messageBox("Amount needs to be between 0 and 30.", "Error: Wrong Amount");

          this.rawValue = null;

}

View solution in original post

2 Replies
Jono_Moore
Correct answer by
Level 10
Level 10

On the Exit event of the field put you can put something like the following (make sure the Script Editor is set to JavaScript):

if (this.rawValue < 0 || this.rawValue > 30) {

          xfa.host.messageBox("Amount needs to be between 0 and 30.", "Error: Wrong Amount");

          this.rawValue = null;

}

efmbman
Level 1
Level 1

Amazing... thanks SO MUCH!! If I did not shave my head, I would have pulled all my hair out by now. So simple!