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 pattern for positive values only

Avatar

Former Community Member
What pattern must be set to disallow users input negative values?
2 Replies

Avatar

Former Community Member
Why not just use the absolute function in javascript to force the number to positive after it has been entered?

Avatar

Former Community Member
Hey Paul it's quite simple and good idea! I used something like this:



form1.#subform[0].NumericField1::exit - (JavaScript, client)

this.rawValue=Math.abs(this.rawValue);



And it works fine, Thanks!