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

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

LBarton
Level 2
Level 2

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!

1 Accepted Solution
_Bruce_Robertson
Correct answer by
Level 10
Level 10

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.

View solution in original post

0 Replies
_Bruce_Robertson
Correct answer by
Level 10
Level 10

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.

View solution in original post