HTML Input form* Attributes

Date: 12-16-24

This chapter describes the different form* attributes for the HTML <input> element.

The form Attribute

The input form attributes specifies the form the <input> element belongs to.

The value of this attribute must be equal to the id attribute of the <form> element it belongs to.

The input form attributes



The "Last name" field below is outside the form element, but still part of the form.

The formaction Attribute

The input formaction attribute specifies the URL of the file that will process the input when the form is submitted.

Note: This attribute overrides the action attribute of the <form> element.

The formaction attribute works with the following input types: submit and image.

The input formaction attribute





The formenctype Attributes

The input formenctype atribute specifies how the form-data should be encoded when submitted (only for forms with method="post").

Note: This attribute overrides the enctype attribute of the <form> element.

The formenctype attribute works with the following input types: submit and image.

The input formenctype attribute



The formmethod Attribute

The input formmethod attribute defines the HTTP method for sending form-data to the action URL.

Note: This attribute overrides the method of the <form> element.

The formmethod attribute works with the following input types: submit and image.

The form-data can be sent as URL variables (method="get") or as an HTTP post transaction (method="post").

Notes on the "get" method:

Notes on the "post" method:

The input formmethod Attribute