splitforms.com

HTML · GLOBAL ATTRIBUTE

HTML inputmode attribute: pick the mobile keyboard

inputmode only hints which virtual keyboard a phone shows: none, text, decimal, numeric, tel, search, email or url. Unlike type, it adds no validation and doesn't change the submitted value. For digit strings that aren't quantities, like ZIP codes, use type="text" inputmode="numeric" with pattern, so leading zeros are kept.

  • 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

inputmode-example.html
<input type="text" name="zip" inputmode="numeric" pattern="[0-9]{5}" autocomplete="postal-code">

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 inputmode 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.

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

  <label for="zip">ZIP code</label>
  <input type="text" id="zip" name="zip" inputmode="numeric" pattern="[0-9]{5}" autocomplete="postal-code" required>

  <label for="code">One-time code</label>
  <input type="text" id="code" name="code" inputmode="numeric" autocomplete="one-time-code" pattern="[0-9]{6}">

  <label for="amount">Amount</label>
  <input type="text" id="amount" name="amount" inputmode="decimal">

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

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

inputmode values

Which keyboard does each inputmode value show?

Each inputmode value asks the phone for a different on-screen keyboard, while the field still accepts and submits whatever text is typed.

Which keyboard does each inputmode value show?
ValueKeyboard shownUse it for
noneNo on-screen keyboardFields that open your own picker or keypad
textThe standard keyboard (the default)Ordinary text
decimalDigits plus a decimal separatorPrices, amounts, weights
numericDigits 0–9 onlyZIP codes, one-time codes, card numbers, PINs
telTelephone keypad with 0–9, * and #Phone numbers (prefer type="tel")
searchStandard keyboard with a Search keySearch boxes (prefer type="search")
emailKeyboard with @ and . keysEmail addresses (prefer type="email")
urlKeyboard with / and . keysWeb addresses (prefer type="url")

The exact layout depends on the phone OS and the keyboard app the visitor uses.

Sources: MDN: inputmode

Attributes · inputmode

Which attributes go with inputmode?

inputmode picks the keyboard. These attributes add the checks and autofill it leaves out.

HTML inputmode attribute attributes and what each one does
AttributeWhat it doesDocs
inputmodeThe keyboard hint, like inputmode="numeric". It changes only the on-screen keyboard, not what the field accepts.MDN
patternA regular expression the whole value must match, like [0-9]{5}. Add it, because inputmode checks nothing.MDN
autocompleteLets the browser fill the field, such as postal-code or one-time-code for codes sent by SMS.MDN
enterkeyhintSets the label of the Enter key on mobile keyboards, such as next, done or send.MDN

Common mistakes

inputmode mistakes to avoid

Most problems come from using type="number" for codes, or expecting inputmode to validate.

  1. Don't use type=number for ZIP codes or card numbers

    type="number" drops leading zeros, adds spinner arrows and can change the value when the visitor scrolls. Use type="text" with inputmode="numeric" for digit strings that aren't quantities.

  2. inputmode adds no validation

    A visitor can still paste or type letters. Add pattern, like [0-9]{5}, and check the value again on the server.

  3. Desktop browsers ignore it

    inputmode only changes on-screen keyboards. On a laptop with a physical keyboard, nothing changes.

  4. numeric has no minus or decimal key on iPhone

    The iOS numeric keypad shows only digits. Use inputmode="decimal" for amounts that need a decimal point.

  5. Don't add it to email, tel or url inputs

    type="email", type="tel" and type="url" already show the right keyboard. Adding inputmode there is redundant.

Sources: WHATWG HTML Standard: inputmode · MDN: inputmode

Key benefits

Copy-paste ready

The HTML inputmode 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 inputmode 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 inputmode form actually sends data to a free splitforms backend, with spam filtering built in.

How it works

How to add HTML inputmode attribute to any page.

Copy the html inputmode 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 inputmode 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 inputmode attribute questions, answered.

Anything missing? Email us, we read every message.

A person reading answers to common questions
What is the difference between inputmode and type="number"?

type="number" makes a number field: it blocks non-numbers, adds spinners, checks min, max and step, and drops leading zeros. inputmode="numeric" only shows a number keyboard on phones; the field stays a text field and sends exactly what was typed.

How do I show a numeric keyboard for a ZIP code?

Use <input type="text" inputmode="numeric" pattern="[0-9]{5}" autocomplete="postal-code">. Phones show a number keyboard, the pattern checks for five digits, and a ZIP like 02134 keeps its leading zero.

Does inputmode validate the input?

No. inputmode only changes the on-screen keyboard. Visitors can still paste letters, so add pattern for a browser check and validate the value on the server.

What is the difference between inputmode decimal and numeric?

numeric shows digits 0 to 9 only. decimal adds the decimal separator for the visitor's locale, such as a dot or comma, so use it for prices and amounts.

Does inputmode work on iPhone and Android?

Yes. Safari on iOS and Chrome on Android both support inputmode and switch the on-screen keyboard. The exact layout depends on the OS and the keyboard app, and desktop browsers ignore it.

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