splitforms.com

HTML · ELEMENT

HTML <datalist>: input suggestions that still allow free text

Last reviewed

A <datalist> holds a list of <option> values that a browser suggests while someone types in an <input>. You link the two by giving the datalist an id and putting that id in the input's list attribute. People can still type anything they like, and only the input's own value is submitted as name=value.

  • 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

datalist-example.html
<input list="cities" name="city">
<datalist id="cities">
  <option value="Toronto">
  <option value="Vancouver">
  <option value="Montreal">
</datalist>

Copy-paste code

HTML datalist 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.

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

  <label for="name">Name</label>
  <input type="text" id="name" name="name" autocomplete="name" required>

  <label for="city">City</label>
  <input type="text" id="city" name="city" list="cities">
  <datalist id="cities">
    <option value="Toronto">
    <option value="Vancouver">
    <option value="Montreal">
  </datalist>

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

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

Attributes · <datalist>

Which HTML datalist attributes matter?

These attributes decide how the <datalist> behaves and what actually gets emailed to your inbox when someone submits.

HTML datalist attributes and what each one does
AttributeWhat it doesDocs
listGoes on the <input> and holds the id of the <datalist> whose options are suggested.MDN
idGoes on the <datalist>. The input's list attribute must match it exactly.MDN
valueGoes on each <option>. This is the text that fills the input when the suggestion is picked, and so the text that gets sent.MDN
labelOptional extra text on an <option>. Some browsers show it next to or instead of the value; it is never sent.MDN

Common mistakes

HTML datalist not working? Here's why.

Most broken forms come down to a few small mistakes with the <datalist>. Check these before you ship, then forward every submission to Slack or a webhook.

  1. It is not a select

    A datalist only suggests. People can type any text and submit it, so if only listed values are valid, check the value on the server (or use a <select>).

  2. The datalist itself is never submitted

    A <datalist> has no name and sends nothing. Only the <input> that points at it is sent, under the input's name.

  3. Browsers show the list differently

    Each browser draws the suggestions its own way, and support varies by input type (for example on date, color or range inputs). Make sure the field still works as a plain input.

  4. The value is sent, not the label

    When an <option> has both a value and a label, picking it fills the input with the value. That is what your backend receives.

Sources: WHATWG HTML Standard: The datalist element · MDN: <datalist>

Copy-paste ready

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

How it works

How to add HTML datalist to any page.

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

Copy the code

Copy the HTML datalist example below.

Add your access key

Replace YOUR_ACCESS_KEY with a free splitforms key from the dashboard.

Paste into your site

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

How SplitForms works

What happens after someone submits your form?

splitforms receives the submission, filters spam, saves it to your dashboard and emails you — then, on paid plans, sends it on to your webhooks and integrations. No backend infrastructure to build.

A SplitForms contact form submission launching straight to your inbox

Add your endpoint

Point your form to your unique SplitForms endpoint. That's it.

HTML form pointing at a SplitForms submit endpoint

Receive submissions

We instantly capture and organize every submission in your inbox.

Submissions inbox with searchable leads and status pills

Route anywhere

Send data to email, spreadsheets, CRMs, webhooks, and 7,000+ apps.

Generic integration tiles for email, sheets, chat, CRM, automate, and webhook

No credit card required. Set up in under 60 seconds.

Connect & automate

Where can submissions go besides email?

On paid plans, submissions can also go to Slack, Discord, Google Sheets, Notion, Airtable, Zapier or any signed webhook — and splitforms works on the platforms you build on, from WordPress and Shopify to Next.js. With Stripe connected, your forms can take payments too.

Connect your SplitForms form to Slack, Google Sheets, Mailchimp, Zapier and more
NewTake payments on your formsDeposits, bookings, order forms — submitters check out through Stripe and the money goes straight to your Stripe account. Included on every paid plan.See payment forms →Need time slots? Online booking →

Setup guides for the stacks you use

Questions

HTML datalist questions, answered.

View all FAQs
What is the difference between datalist and select?

A <select> only lets people pick one of your options. An <input list> with a <datalist> suggests options but still accepts any typed text. Use select when the answer must be on the list, and datalist when the list is just a shortcut.

How do I allow only the values in the datalist?

HTML alone can't do it. Add a pattern attribute that matches only the listed values, or check the value on the server against your list. Anyone can POST any text, so the server check is the one that counts.

Is the datalist submitted with the form?

No. The <datalist> has no name and is never submitted. Only the input's value is sent.

Which input types work with datalist?

The list attribute works on text, search, email, url, tel, number, range, date and time inputs, among others. Text-like inputs show a suggestion dropdown; range inputs may show tick marks. How each browser shows it varies.

What does the backend receive from an input with a datalist?

A normal name=value pair from the input, such as city=Toronto, whether the person picked a suggestion or typed it. The datalist adds nothing to the submission.

Simple pricing

How much does splitforms cost?

Free gives you 500 submissions for $0 — no card, no time limit. Pro is $5/month for 5,000 submissions a month, and Annual is $49/year for 15,000 a month with every Pro feature.

Free

$0— 500 submissions
 

No card, no time limit

Best for testing

For side projects and indie devs.

  • 500 free submissions
  • Unlimited forms
  • Email notifications included
  • Smart spam filtering
  • Submissions dashboard
  • Redirect after submit
  • MCP server included

Annual

$49/ year
About $4.08 per month, billed yearly
Best value

Every Pro feature with triple the volume — $0.27 per 1,000 at full use.

  • 15,000 submissions per month
  • Unlimited forms
  • Everything in Pro
  • File uploads with 5 GB storage
  • 3 team seats
  • Priority email support

No credit card required on Free • Cancel anytime • Full pricing and FAQ