Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

Numeric field changes to 2147483647 automatically

Avatar

Former Community Member

Hi

I have a numeric field in the form which is not taking any value more than 9 digits. If we try to enter more than 9 digits, It automatically changes to

'2147483647' number.

Can anyone the reason pls and also the solution.

Thanks In advance

Abhiram

2 Replies

Avatar

Level 9

Hi Abhiram,

What validation pattern have you set for the field?

Thanks,

Bibhu.

Avatar

Level 10

Hi Abhiram,

This is the maximum for a numeric field, anything above this value will be truncated (this is 2^31 -1).  You may want the following JavaScript in the change event of the field.

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

if (isNaN(newValue) || newValue < -2147483648 || newValue > 2147483647)

{

    xfa.event.change = "";

}

If you need larger values your will need use a text field.

Bruce