splitforms.com

HTML · ATTRIBUTE

HTML step attribute: decimals, time slots and stepMismatch

step sets the gap between allowed values on number, range, date, time, datetime-local, month and week inputs. The default is 1 for number and range, 60 seconds for time, 1 day for date and 1 month for month. A value that doesn't fit the step sets validity.stepMismatch and blocks the submit; step="any" turns the check off.

  • Live, editable example
  • Copy-paste snippet
  • Attributes & common mistakes
Live demo · nothing is sent

What gets submitted

Fill in the form above and press its button. The demo stops the request and lists every name=value pair the browser would send, plus the controls it leaves out.

With a free access key in the form, these fields land in your splitforms dashboard; access_key and botcheck are read by splitforms, not stored as lead data.

Edit the HTML and re-run it
Runs in a sandbox. Nothing is sent.

Minimal snippet

step-example.html
<input type="number" name="price" min="0" step="0.01" required>

Want this form to email you its submissions? Point it at a free splitforms endpoint, with no server to build. Get a free access key →

Copy-paste code

HTML step attribute code you can paste today.

Replace YOUR_ACCESS_KEY with a key from your free splitforms dashboard. The form posts to one endpoint — submissions land in your inbox and dashboard with spam filtering built in.

step.html
<form action="https://splitforms.com/api/submit" method="POST">
  <input type="hidden" name="access_key" value="YOUR_ACCESS_KEY">

  <!-- Prices: allow cents (or use step="any" to allow any decimal) -->
  <label for="price">Price</label>
  <input type="number" id="price" name="price" min="0" step="0.01" required>

  <!-- Odd numbers only: steps count from min, so 1, 3, 5... -->
  <label for="seats">Seats (odd numbers)</label>
  <input type="number" id="seats" name="seats" min="1" step="2">

  <!-- Time step is in seconds: 900 = 15-minute slots -->
  <label for="time">Time</label>
  <input type="time" id="time" name="time" min="09:00" max="17:00" step="900" required>

  <!-- Honeypot: hidden from people, bots fill it in -->
  <input type="checkbox" name="botcheck" style="display:none">

  <button type="submit">Send</button>
</form>

Attributes · <input step>

Which attributes work with step?

min (or value) sets where the steps start; max sets where they stop.

HTML step attribute attributes and what each one does
AttributeWhat it doesDocs
stepThe gap between allowed values, counted from min. step="0.01" allows cents; step="any" turns the check off. For time inputs it is in seconds.MDN
minThe lowest allowed value and the step base: with min="1" step="2", only 1, 3, 5… pass. Without min, the base is the value attribute.MDN
maxThe highest allowed value. The arrow keys and spinner stop at the last valid step below it.MDN
valueThe starting value, and the step base when there is no min.MDN

Common mistakes

step mistakes to avoid

Most problems come from the default step of 1, an unexpected step base, or trusting the browser alone.

  1. type=number with no step rejects 9.99

    The default step is 1, so a number input without step only accepts whole numbers and flags 9.99 as stepMismatch. Add step="0.01" for prices, or step="any" to allow any decimal.

  2. The step base is min, not 0

    Allowed values are min plus whole steps. With min="1" step="2", 2 and 4 fail and the browser says something like "Please enter a valid value. The two nearest valid values are 1 and 3." Without min, the base is the value attribute.

  3. Time step is in seconds

    On type="time", step="15" means 15 seconds, not 15 minutes; use step="900" for 15-minute slots. A step below 60, like step="1", also makes the field show seconds.

  4. The picker may ignore step, so check on the server

    Some browsers' time and date pickers still let people choose any value and only block it on submit. Anyone can also remove the attribute or send the form without the browser, so check the value against your step on the server too.

Sources: WHATWG HTML Standard: the step attribute · MDN: step

Key benefits

Copy-paste ready

The HTML step attribute example below is a complete, working form — paste it into any HTML page and it submits, no edits to the markup required.

No backend to build

Your html step attribute form posts to one endpoint. No server, PHP, or API route — accepted submissions are saved to your dashboard before owner notification email is attempted; delivery time and inbox placement depend on provider and recipient settings.

A form that really submits

Unlike a static reference snippet, this <input step> form actually sends data to a free splitforms backend, with spam filtering built in.

How it works

How to add HTML step attribute to any page.

Copy the html step attribute example, drop in your free access key, and paste it into any page — submissions start landing in your dashboard.

  1. Copy the code

    Copy the HTML step attribute example below.

  2. Add your access key

    Replace YOUR_ACCESS_KEY with a free splitforms key from the dashboard.

  3. Paste into your site

    Drop the form into any HTML page. Submissions arrive in your dashboard.

Questions

HTML step attribute questions, answered.

Anything missing? Email us, we read every message.

A person reading answers to common questions
How do I allow decimals in a number input?

Add step="0.01" to allow two decimal places, like prices, or step="any" to allow any decimal. Without step, the default is 1 and a value like 9.99 is flagged as stepMismatch, so the form won't submit.

What does step="any" do?

It turns off step checking, so any value inside min and max is valid. The arrow keys and spinner then move by the type's default step, like 1 for a number input.

What is stepMismatch?

validity.stepMismatch is true when the value doesn't land on min (or value) plus a whole number of steps. The browser blocks the submit with a message like "Please enter a valid value. The two nearest valid values are 1 and 3."

How do I make a time input use 15-minute slots?

Use step="900", because the time step is in seconds (15 × 60). The arrow keys then move 15 minutes at a time, and a typed time like 09:10 is flagged as stepMismatch. Set min, like min="09:00", so the slots start on the hour.

Does step stop bad values reaching my backend?

No. step is only a client-side check: it can be removed in dev tools, skipped with novalidate, or bypassed by a script or bot. Always check the value again on the server.

View all FAQs

Make this form actually submit.

Point your form at splitforms. 500 free submissions a month, spam filtering, webhooks on paid plans — no server.

  • No credit card required
  • 500 free submissions
  • Setup in minutes
Two people celebrating a working contact form