Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.

Adobe changes my numeric field to include commas when validation fails

Avatar

Level 3

Adobe changes my numeric field to include commas when validation fails. My numeric validation setting is num{zzzzzzz9.99}. I want my numeric field to display as 99999999.00, no commas and only to have 2 decimals places. I added this validation to the Display, Edit, Validation and Data tabs under the validation pattern dialog box.

When validation fails, adobe changes the display of the field to include commas and drops the decimal places:

999,999,999

How can I prevent this from happening? Any feedback is greatly appreciated.

I've also added a change event to the field as well:

\\only allows numbers and period.

if (xfa.event.newText.match(/[^0-9.]/))

{

xfa.event.change = "";

}

\\only allows 11 characters to be entered.

var maxLength = 11;

if(xfa.event.newText.length >maxLength)xfa.event.change = "";

4 Replies

Avatar

Level 10

Sorry, I can't follow your explaination.

What value do you enter in your field and what way you would it like to be displayed?

Avatar

Level 3

I want it to display only numbers followed by 2 decimal places.

999999999.00

If I type all numbers in my field like 999999999999 and I go over the character limit of 11. My validation fails and then my numeric field is displayed with commas, 999,999,999 without the 2 decimal places. Is there a way to prevent adobe from automatically changing my fields?

Avatar

Level 10

The displayed number has nothing to do with the validation that fails.

If it is not possible to format the entered value with the display pattern, the value will be formatted as there is no display pattern.

Just change your display pattern into something like num{zzzzzzzzzzzzzzzzzzz9.99}, so it will format larger numbers too.