Loading...

HTML Form Attributes

The form tag accepts attributes that change submission behavior. Master action and method first, then useful extras.

Direct answer

  • action — URL that receives the data
  • method — usually get (query string) or post (request body)
  • autocomplete — allow/deny browser autofill hints (on/off)
  • novalidate — skip built-in HTML field checks on submit (use carefully)

📊 Common form attributes

Attribute Role
action Submission destination URL
method get or post
autocomplete Autofill behavior hint
novalidate Disable built-in field checks for that submit path
name / id Identify the form element itself

Form attributes in practice

html
HTML Code
<form
id="contact"
action="/contact"
method="post"
autocomplete="on">
<label for="name">Name</label>
<input id="name" name="name" type="text">
<button type="submit">Send</button>
</form>

Try it

  1. Build a small form with method="get" and watch the query string after submit (even if the page 404s)
  2. Switch to method="post" and compare
  3. Toggle autocomplete="off" on a practice field set
  4. Note when you might use novalidate only for special demos

Easy mistakes

  • Empty action without understanding it submits to the current URL
  • Sending passwords with get (visible in URLs/logs)
  • Disabling field checks with novalidate permanently in production demos

Summary

  • action + method are core
  • Prefer post for private or large data
  • autocomplete and novalidate are optional tools
  • Name forms when scripts need them

🧠 Test Your Knowledge

Ready to Start

Test Your Knowledge

Challenge yourself with this interactive quiz and see how well you understand the topic

❓
5
Questions
🎯
70%
To Pass
♾️
∞
Time
🔄
∞
Attempts

📝 Instructions

  • Read each question carefully
  • Select the best answer for each question
  • You can retake the quiz as many times as you want
  • Your progress will be shown at the top