Skip to content
Interface language: English
Design / Signal

1,5 or 1.5? A number field needs clear rules

Set number-entry rules for decimal commas, periods, increments, pasting, empty fields, and precision without silently changing the customer’s chosen value.

Article language: English

Aeneia concept image: a woman adjusts a gear mechanism beneath two large pale discs.
In this article

A customer enters “1,5” and the form asks for a “valid number” without an explanation. They wanted to order one and a half meters. They still do not know what to correct.

Consider a fictional store selling decorative tape cut to length. The customer enters a measurement in meters, the store allows a particular cutting increment, and the form passes the accepted length to the order. Look at the field before the price is calculated. If it changes the meaning of the input, later calculations will describe a different order even when the formula is correct.

That is why Aeneia Design's interaction design work also includes defining input rules. A mockup containing the digit “1” does not answer whether the customer can enter a fraction, paste a value with a unit, or briefly empty the field. Those behaviors need to be settled before acceptance testing.

Understand the intention before correcting the notation

Start with the label: “Length in meters” says more than “Value.” Show the unit outside the empty field's example, which disappears during typing. If the user needs to enter centimeters, display the correct unit beside the field instead of a fixed “m”.

Next, define the number notation you accept. In the Polish version, the customer expects a decimal comma but may paste a number from software that uses a period. Decide which forms to accept and how to show the interpreted value. Do not automatically remove every comma: “1,5” could become “15”, changing the length ordered.

React Aria's NumberParser documentation describes parsing numbers according to the language, region, and expected format. It also distinguishes validating partial input from parsing a completed value. It is not a mechanism for freely guessing whether a user intended a unit, a percentage, or another kind of data.

If you accept a single period as the decimal separator, show an unambiguous result in the agreed notation after confirmation. If a pasted value contains different separators and cannot be safely interpreted, ask the customer to correct it.

Paste “1,234” during the test as well. Before accepting that text, you need to know whether the comma represents a fraction or thousands grouping in its source. Do not choose for the customer simply because both interpretations produce valid numbers. In our store, the unit and the rule should narrow the possibilities; where ambiguity remains, the customer should be asked about the specific length.

Also let them compare what they entered with what was accepted: “Parsed length: 1,234 m” provides different information from the mere absence of a red error message. If the offer permits only two digits after the separator, a decision about correction or rounding is still needed. Parsing a number does not establish that it meets the order's conditions.

Pay attention to language changes. A previously stored number should not change magnitude simply because the form switches its display format. The field may show a different separator, but one and a half meters must remain the same quantity. Designing and reviewing language versions (in Polish) needs to include data like this.

This is different from digits in an address or identifier. “0012” can be a meaningful string that needs to be preserved in full, and “12B” is not a number for a calculation. In the article on an international address form (in Polish), we show why an apparently numeric field must not automatically be treated as a quantity.

Define the step separately from decimal places

The store might sell tape in five-centimeter increments. The allowed lengths must follow that increment. Displaying two decimal places does not define this rule. “1,23” has two decimal places but may not match an available cut. “1,50” and “1,5” can mean the same length.

Do not confuse adding a zero with rounding, either. Displaying 1,5 as 1,50 changes the notation, not the magnitude. Replacing 1,246 with 1,25 changes the magnitude, although the difference may look harmless. If the tape will be cut to the accepted measurement, the customer needs to know which operation took place. The confirmation button should refer to a visible value they understand.

Agree on whether reopening the field shows every stored digit or a shortened result. Do not leave hidden precision that resurfaces only in the next calculation. For our hypothetical offer, one solution could be to store only the confirmed length that matches the cutting increment. Another product may need to retain a measurement separately; that is a deliberate data decision, not a typographic detail.

MDN describes the step attribute as defining an increment and the allowed values relative to a step base. For a numeric HTML field, that base is determined by min, then value, and zero if neither is provided. The default step for a number field is one; any removes the step restriction while leaving other constraints in place.

With a base of 0,10 m and a step of 0,05 m, using the Polish decimal-comma notation here, the sequence includes 0,10, 0,15, and 0,20 m. In another hypothetical version, the minimum is 0,12 m and the step remains 0,05 m: the values are 0,12, 0,17, and 0,22 m. This second version has not been tested in a real store; it illustrates only the arithmetic effect of the starting point.

Aeneia conceptual photography

If the owner expects a different sequence, change the rule and configuration, not just the label beside the field. Check that the browser accepts the agreed set of lengths, starting with the minimum itself.

Define whether the plus button increases the length by the allowed step and what it does after someone enters a value between steps. If it changes “1,23” to “1,25”, show the correction before the customer confirms the length.

For the broader calculation context, see designing a calculator with units and assumptions (in Polish). At this stage, check that the calculation receives exactly the number the user knowingly confirmed.

Let people finish entering the number

To change “1,5” to “2,5”, a user may select all the contents and start with an empty field. For a moment, it contains no valid number. Let them finish editing; an empty field does not confirm a zero-length order. Do not insert a zero automatically if it makes entering the next character harder.

Someone who has entered only “1,” may still be typing the decimal part. Correcting it to “1” too soon can move the cursor and make editing harder. Define when to validate the input and when to confirm the value. Let people finish typing, then check the completed value against the agreed rules.

Do not mix up an empty answer and zero. In the store, a missing length means no decision has been made; zero may be a rejected quantity or a separate action, depending on the design. If the field is required, ask for a length when the customer tries to continue. Do not store zero simply because passing a number is easier than representing a missing answer.

If the form begins with a suggested one-meter length, identify that suggestion and show it before confirmation as well. Moving to the next step must not hide a default measurement among the data. After the customer deletes the value, let them enter their own; automatically restoring one meter after every deletion makes it harder to change their intention.

Make clear when the value is saved. Leaving the field may validate its contents without saving the order. For edits to an existing record, make that point explicit, as described in the article on editing a value in place (in Polish). A new length displayed in the field does not prove that the store has accepted it.

On a phone, check the available characters. MDN explains inputmode as a hint for choosing an on-screen keyboard; it does not itself enforce a value's validity. The decimal mode provides a decimal separator that depends on locale settings, and the device may show or omit a minus key. That describes the possibilities, not a guarantee of the same keyboard everywhere.

Choose a keyboard that suits the characters actually needed, then work through the task on the agreed devices. If a negative number makes sense, check how to enter one. If it does not, state the restriction. Do not treat a hidden minus key as your only safeguard: a value can still be pasted.

Test ordinary keyboard editing: moving to the field, selecting everything, replacing the value, and leaving without confirming. If arrow keys change the length, their effect should match the step rule. If scrolling the page over the active field changes the number in this implementation, check whether the user notices and can easily undo it. Test the chosen field and device.

Check the saved value

Pasting exposes assumptions that may remain invisible during careful typing. Prepare “1,5”, “1.5”, a leading space, and a value containing a unit. Decide separately whether the unit is accepted or must be removed manually. Do not add automatic conversion simply because “150 cm” appears on the clipboard. That is an additional feature with its own rules.

For each test input, specify the length to accept or the message to display. Without an agreed result, the designer and developer could consider two different behaviors correct. In a separate test, send data that breaks the rule to the server handling the form and check that it is rejected. A green border in the browser cannot replace validation by the system accepting the order.

Test a value with more digits after the separator than the offer allows. If the form rounds it, show the result before acceptance. If it rejects the value, leave the text available for correction and explain the required precision. Say what to change in that input rather than simply asking for a “valid value.”

Read the length together with its unit in the order summary. Then reopen the saved data and compare it with the confirmed result. A cart that allows quantity corrections (in Polish) introduces further dependencies, but even a single field should preserve the agreed magnitude.

Enter a length that is not allowed, read the message, and correct it without clearing the form. Check that the message gives enough guidance to finish the correction.

Aeneia / Aeneia editorial

Editorial article. Source links are included in the text.

About Aeneia

Brands we have worked with

  • L’Oréal
  • Garnier
  • Netflix
  • Carrefour
  • Warner Bros. Discovery
  • Biedronka
  • HBO Max
  • Wolt
  • Żabka
  • COSRX
  • Embassy of China in Poland
  • Mixa
Aeneia / Initium

From knowledge to a decision

Tell us what you want to put in order. We will agree on where to start.

Contact Aeneia

We partner with and use solutions from:

  • Google
  • OpenAI
  • Microsoft
  • Stripe
  • Anthropic
  • Linear