HTML Form Attributes
Subject: html
๐งพ HTML Form Attributes
HTML forms use various attributes to control how data is submitted and processed. These attributes define where the form data is sent, how it's sent, and how it behaves during interaction.
โ๏ธ Important Form Attributes
1. action
- Specifies the URL to which the form data is submitted.
 - Can be an absolute or relative URL.
 - Example:
 
2. method
- Defines the HTTP method used for submission.
 - Common values:
GET: Appends form data to the URL (not secure, limited data).POST: Sends data in the request body (secure, suitable for large/sensitive data).
 - Default: 
GET 
3. enctype
- Specifies the encoding type of the submitted data.
 - Common values:
application/x-www-form-urlencoded(default)multipart/form-data(required for file uploads)text/plain
 - Used only with 
method="POST" 
4. target
- Controls where to display the response after submission.
 - Values:
_self(default): Same tab/window_blank: New tab or window_parent: Parent frame_top: Full body of the window
 
5. autocomplete
- Enables/disables browser autofill.
 - Values: 
on(default) |off 
6. novalidate
- When present, disables browser's built-in validation before submitting the form.
 
๐งช Example: Form Using Common Attributes
โ Key Takeaway
actioncontrols where data is submitted.- Use 
method="POST"for secure and large data submissions. - Set 
enctype="multipart/form-data"for file uploads. targetcontrols where the response appears.autocompleteimproves user convenience;novalidatebypasses validation.
Understanding form attributes is essential for building secure, accessible, and user-friendly web forms.
Advertisement Slot 1
Advertisement Slot 2