Form Attributes in HTML

From the HTML cheat sheet · Forms & Input Elements · verified Jul 2026

Form Attributes

Important attributes for form controls

html
<!-- Input attributes: required (must fill), disabled (cannot edit), readonly (select not edit), autofocus (focus on load), autocomplete, pattern (regex validation) -->
<input type="text"
  required
  disabled
  readonly
  autofocus
  autocomplete="on"
  placeholder="Hint text"
  pattern="[A-Z]{3}"
  title="Three uppercase letters">

<!-- Form attributes: action (where to send), method (GET/POST), enctype (multipart for file uploads), autocomplete, novalidate (skip HTML5 validation) -->
<form
  action="/submit"
  method="POST"
  enctype="multipart/form-data"
  autocomplete="off"
  novalidate>

<!-- Button types -->
<button type="submit">Submit Form</button>
<button type="reset">Clear Form</button>
<button type="button">Just a Button</button>
💡 required, pattern, min/max for validation
📌 autocomplete helps users fill forms faster
⚠️ disabled fields don't submit with form
⚡ form attribute links inputs outside <form>
🟢 Essential for user experience and validation
attributesvalidationforms

Continue with HTML

Save the full cheat sheet or work through every related task.

More HTML tasks

Back to the full HTML cheat sheet