Accent Fields Number

Integer

Whole numbers only — counts, capacities, and money stored as exact cents.


On a text face, stepping follows the place under the caret — 2|50 ↑ → 350; unfocused, it steps by one:

Whole numbers: a number with the integer rule set — the Number family's constrained variant. Counts, capacities, ordering weights, a year, an ID that really is arithmetic.

The contract

The boundary refuses a fractional part: 2.5 in a seat count is rejected where it enters, not discovered by a template printing "2.5 seats". A whole float is still whole — 2.0 arrives as 2 and passes — because the rule asks about the value, not how it was written.

Unasked, fractions stay legal. integer is a contract you declare, not a default the type assumes.

Declaring one

Label Capacity
Key capacity
Data type number
Editor text_input
Validation integer: true, usually with min
<p><%= cms.asset.content.capacity %> seats</p>
{ "content": { "capacity": 45 } }

Money belongs here

Prices are the classic reason to reach for integers rather than floats: store cents as a whole number and format in the template. 19.99 is not exactly representable in binary floating point, and the error compounds the moment you sum a cart. An integer of 1999 is exact, sums exactly, and becomes $19.99 at the one place that should care — the template.

When not to use it

  • Measurements, ratings, rates — a fractional part is meaningful: float.
  • Digits that are never math — a phone number, a postcode, a zip: text, where leading zeros survive.