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
BedrockMission!

Learn More

View all

Sign in to view all badges

How to remove invalid user-entered data?

Avatar

Avatar
Validate 1
Level 1
mockions
Level 1

Like

1 like

Total Posts

3 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 1
View profile

Avatar
Validate 1
Level 1
mockions
Level 1

Like

1 like

Total Posts

3 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 1
View profile
mockions
Level 1

23-03-2015

For example, if a user enters 5 digits (or any amount of digits that is not 😎 into Field1 instead of a 8 digits and tries to go to the next field, I want to be able to trigger a validation warning and stop the user from continuing to populate the rest of the form until they either a) deleted input or b) entered in an 8-digit number. In short, I don't want any of the form fields to be able to retain invalid data.

I am thinking about something akin to Excel's "data validation" process when "ignore blank" is unchecked.

Any help would be appreciated.

Accepted Solutions (0)

Answers (1)

Answers (1)

Avatar

Avatar
Validate 1
Level 4
jasotastic81
Level 4

Likes

35 likes

Total Posts

329 posts

Correct Reply

43 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 25
Boost 10
View profile

Avatar
Validate 1
Level 4
jasotastic81
Level 4

Likes

35 likes

Total Posts

329 posts

Correct Reply

43 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 25
Boost 10
View profile
jasotastic81
Level 4

26-03-2015

Add this to the exit event of your field:


if (!this.isNull) if(this.rawValue.length != 8){


  xfa.host.messageBox("You must enter 8 characters or leave this blank.");


  xfa.host.setFocus(this);


}



The extra "if" statement ensures that the text field isn't empty before checking the length to keep from throwing an error.