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

LiveCycle Designer ES2 - validation pattern and limit length: max chars

Avatar

Avatar
Validate 1
Level 1
LBarton
Level 1

Like

1 like

Total Posts

4 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 1
View profile

Avatar
Validate 1
Level 1
LBarton
Level 1

Like

1 like

Total Posts

4 posts

Correct Reply

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

05-06-2015

I am new to using LiveCycle to design forms.  This seems like it should be a really simple thing, but I am stuck on how to do it.

I have a Zip Code field.  It is set for both Zip and Zip + 4 Display and Validation Patterns.  The  Validation Pattern is text{99999}|text{999999999}.

I have a script that stops the entry of alpha characters.  I would also like to prevent users from entering more than 9 characters.  I would think the

Limit Length:  Max Chars:  feature would take care of this....but it doesn't.  I can't turn on the Limit Length because I get a warning that it conflicts

with my pattern.  Doesn't make sense to me because my pattern has a max of 9 numbers and I want my Limit Length to have a max of 9 characters.

I know I can use the pattern validation to provide a warning error message that tells a user to enter either 5 or 9 digits, but why can't I just stop them at 9?

Any help would be appreciated.

Thanks!

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Boost 50
MVP
_Bruce_Robertson
MVP

Likes

270 likes

Total Posts

1,782 posts

Correct Reply

372 solutions
Top badges earned
Boost 50
Boost 5
Boost 3
Boost 250
Boost 25
View profile

Avatar
Boost 50
MVP
_Bruce_Robertson
MVP

Likes

270 likes

Total Posts

1,782 posts

Correct Reply

372 solutions
Top badges earned
Boost 50
Boost 5
Boost 3
Boost 250
Boost 25
View profile
_Bruce_Robertson
MVP

05-06-2015

Hi,

It does still seem to work, you just get an annoying warning at design time.

If you were to use a numeric field then you could have code in the change event to limit the length, and that way they wouldn't be able to type alphanumeric characters either.

var newValue = parseInt(xfa.event.newText, 10);

if (isNaN(newValue) || newValue < 0 || newValue > 999999999)

{

    xfa.event.change = "";

}

You would then need some code in the validate event to test for a value within the two ranges.

Answers (0)