--- title: HTML forms guide slug: Learn/Forms translation_of: Learn/Forms original_slug: Web/Guide/HTML/Forms ---
Panduan ini adalah seri dari artikel-artikel yang akan membantu anda menguasai form HTML. Form HTML adalah tool yang paling poweful untuk berinteraksi dengan para pengguna; namun, karena beberapa alasan sejarah dan teknis, tidak jelas bagaimana cara menggunakannya hingga pontensi penuhnya. Dalam panduan ini, kita akan membahas seluruh aspek dari form HTML, struktur form untuk pemberian style, mulai dari penanganan data sampai widget buatan. Anda akan mempelajari bagaimana menikmati kekuatan yang mereka miliki!
Element | Related DOM interface | Description |
---|---|---|
{{HTMLElement("button")}} | {{domxref("HTMLButtonElement")}} | Elemen button menampilkan tombol yang dapat diklik. |
{{HTMLElement("datalist")}} | {{domxref("HTMLDataListElement")}} | Elemen datalist menampung kumpulan dari elemen {{ HTMLElement("option") }} yang merepresentasikan pilihan-pilihan yang mungkin untuk nilai dari elemen form lainnya. |
{{HTMLElement("fieldset")}} | {{domxref("HTMLFieldSetElement")}} | fieldset digunakan untuk menggabungkan beberapa elemen form dalam sebuah form. |
{{HTMLElement("form")}} | {{domxref("HTMLFormElement")}} | Elemen form merepresentasikan bagian dari dokumen yang memiliki elemen interaktif yang memungkinkan pengguna mengirimkan informasi ke web server. |
{{HTMLElement("input")}} | {{domxref("HTMLInputElement")}} | Elemen input digunakan untuk membuat kontrol interaktif untuk form. |
{{HTMLElement("keygen")}} | {{domxref("HTMLKeygenElement")}} | Elemen keygen memfasilitasi pembuatan key secara otomatis dan pengiriman public ke sebagai bagian dari form HTML. |
{{HTMLElement("label")}} | {{domxref("HTMLLabelElement")}} | Elemen label merepresentasikan judul dari sebuah item dalam antar muka user |
{{HTMLElement("legend")}} | {{domxref("HTMLLegendElement")}} | Elemen legend merepresentasikan judul utama dari konten parentnya {{ HTMLElement("fieldset") }}. |
{{HTMLElement("meter")}} | {{domxref("HTMLMeterElement")}} | Elemen meter merepresentasikan nilai skalar dalam jangkauan yang diketahui atau nilai fraksi. |
{{HTMLElement("optgroup")}} | {{domxref("HTMLOptGroupElement")}} | Elemen optgroup membuat grup dari pilihan-pilihan dalam sebuah elemen {{ HTMLElement("select") }}. |
{{HTMLElement("option")}} | {{domxref("HTMLOptionElement")}} | Elemen HTML option digunakan untuk membuat kontrol yang merepresentasikan item yang terdapat dalam sebuah elemen {{ HTMLElement("select") }}, {{ HTMLElement("optgroup") }} atau {{ HTMLElement("datalist") }}. |
{{HTMLElement("output")}} | {{domxref("HTMLOutputElement")}} | Element output merepresentasikan hasil dari sebuah kalkulasi. |
{{HTMLElement("progress")}} | {{domxref("HTMLProgressElement")}} | Element progress digunakan untuk menampilkan progress dari sebuah tugas. |
{{HTMLElement("select")}} | {{domxref("HTMLSelectElement")}} | Elemen select merepresentasikan kontrol yang menyajikan pilihan-pilihan menu. |
{{HTMLElement("textarea")}} | {{domxref("HTMLTextAreaElement")}} | Elemen textarea merepresentasikan sebuah kontrol edit dengan multi baris. |
Note: All form elements, as all HTML elements, support the {{domxref("HTMLElement")}} DOM interface.
Attribute Name | Elements | Description |
---|---|---|
accept | {{ HTMLElement("form") }}, {{ HTMLElement("input") }} | List of types the server accepts, typically a file type. |
accept-charset | {{ HTMLElement("form") }} | List of supported charsets. |
action | {{ HTMLElement("form") }} | The URI of a program that processes the information submitted via the form. |
autocomplete | {{ HTMLElement("form") }}, {{ HTMLElement("input") }} | Indicates whether controls in this form can by default have their values automatically completed by the browser. |
autofocus | {{ HTMLElement("button") }}, {{ HTMLElement("input") }}, {{ HTMLElement("keygen") }}, {{ HTMLElement("select") }}, {{ HTMLElement("textarea") }} | The element should be automatically focused after the page loaded. |
challenge | {{ HTMLElement("keygen") }} | A challenge string that is submitted along with the public key. |
checked | {{ HTMLElement("input") }} | Indicates whether the element should be checked on page load. |
cols | {{ HTMLElement("textarea") }} | Defines the number of columns in a textarea. |
data | {{ HTMLElement("object") }} | Specifies the URL of the resource. |
dirname | {{ HTMLElement("input") }}, {{ HTMLElement("textarea") }} | |
disabled | {{ HTMLElement("button") }}, {{ HTMLElement("fieldset") }}, {{ HTMLElement("input") }}, {{ HTMLElement("keygen") }}, {{ HTMLElement("optgroup") }}, {{ HTMLElement("option") }}, {{ HTMLElement("select") }}, {{ HTMLElement("textarea") }} | Indicates whether the user can interact with the element. |
enctype | {{ HTMLElement("form") }} | Defines the content type of the form date when the method is POST. |
for | {{ HTMLElement("label") }}, {{ HTMLElement("output") }} | Describes elements which belongs to this one. |
form | {{ HTMLElement("button") }}, {{ HTMLElement("fieldset") }}, {{ HTMLElement("input") }}, {{ HTMLElement("keygen") }}, {{ HTMLElement("label") }}, {{ HTMLElement("meter") }}, {{ HTMLElement("object") }}, {{ HTMLElement("output") }}, {{ HTMLElement("progress") }}, {{ HTMLElement("select") }}, {{ HTMLElement("textarea") }} | Indicates the form that is the owner of the element. |
high | {{ HTMLElement("meter") }} | Indicates the lower bound of the upper range. |
keytype | {{ HTMLElement("keygen") }} | Specifies the type of key generated. |
list | {{ HTMLElement("input") }} | Identifies a list of pre-defined options to suggest to the user. |
low | {{ HTMLElement("meter") }} | Indicates the upper bound of the lower range. |
max | {{ HTMLElement("input") }}, {{ HTMLElement("meter") }}, {{ HTMLElement("progress") }} | Indicates the maximum value allowed. |
maxlength | {{ HTMLElement("input") }}, {{ HTMLElement("textarea") }} | Defines the maximum number of characters allowed in the element. |
method | {{ HTMLElement("form") }} | Defines which HTTP method to use when submitting the form. Can be GET (default) or POST. |
min | {{ HTMLElement("input") }}, {{ HTMLElement("meter") }} | Indicates the minimum value allowed. |
multiple | {{ HTMLElement("input") }}, {{ HTMLElement("select") }} | Indicates whether multiple values can be entered in an input of the type email or file . |
name | {{ HTMLElement("button") }}, {{ HTMLElement("form") }}, {{ HTMLElement("fieldset") }}, {{ HTMLElement("input") }}, {{ HTMLElement("keygen") }}, {{ HTMLElement("output") }}, {{ HTMLElement("select") }}, {{ HTMLElement("textarea") }} | Name of the element. For example used by the server to identify the fields in form submits. |
novalidate | {{ HTMLElement("form") }} | This attribute indicates that the form shouldn't be validated when submitted. |
optimum | {{ HTMLElement("meter") }} | Indicates the optimal numeric value. |
pattern | {{ HTMLElement("input") }} | Defines a regular expression which the element's value will be validated against. |
placeholder | {{ HTMLElement("input") }}, {{ HTMLElement("textarea") }} | Provides a hint to the user of what can be entered in the field. |
readonly | {{ HTMLElement("input") }}, {{ HTMLElement("textarea") }} | Indicates whether the element can be edited. |
required | {{ HTMLElement("input") }}, {{ HTMLElement("select") }}, {{ HTMLElement("textarea") }} | Indicates whether this element is required to fill out or not. |
rows | {{ HTMLElement("textarea") }} | Defines the number of rows in a textarea. |
selected | {{ HTMLElement("option") }} | Defines a value which will be selected on page load. |
size | {{ HTMLElement("input") }}, {{ HTMLElement("select") }} | Defines the width of the element (in pixels). If the element's type attribute is text or password then it's the number of characters. |
src | {{ HTMLElement("input") }} | The URL of the embeddable content. |
step | {{ HTMLElement("input") }} | |
target | {{ HTMLElement("form") }} | |
type | {{ HTMLElement("button") }}, {{ HTMLElement("input") }} | Defines the type of the element. |
usemap | {{ HTMLElement("input") }} | |
value | {{ HTMLElement("button") }}, {{ HTMLElement("option") }}, {{ HTMLElement("input") }}, {{ HTMLElement("meter") }}, {{ HTMLElement("progress") }} | Defines a default value which will be displayed in the element on page load. |
wrap | {{ HTMLElement("textarea") }} | Indicates whether the text should be wrapped. |