The form refers to a particular HTML element. It is one of the elements that allow users to interact with the website. In fact, the form element allows the user to type in data and it allows the website to collect these data for further management. As an interactive interface, the form has several entries and several exits. Like all other HTML elements, the form has to be used properly in order to contribute to the success of the website and ensure the highest level of compliance with the SEO principles, the UX principles, and the W3C rules.

Introducing forms:

The form is an HTML element that allows the users to enter some data for processing. The form includes several input elements. Also, the form has many attributes that specify its behavior.

The form would have this representation:

<form some attributes>

Some content

<desired element some attributes>

</form>

The HTML elements of the form:

The form includes the HTML elements that allow the users to enter data. These elements allow typing text or select an element from a list.

Input elements:

The elements that allow the users to enter text are:

  • Text field: represented by the following code

<input type=”text” name=”element name” value=”some value”>

If specified, the field will have the value of the value attribute as the default value.

<input type=”submit” value=”some value”>

The value attribute will display the entered value on the button. The button type can be “submit” or “reset”.

  • Radio: specified as follow

<input type=”radio” name=”name1″ value=”value1″ checked>

The radio element displays radio buttons. The one that is coded “checked will be the checked by default. This input type allows only one choice.

  • Checkbox : the respective code goes like this

<input type=”checkbox” name=”name1″ value=”value1″>some text.

This input type allows more than one element to be checked.

 

  • Textarea: coded as follow

<textarea name=”name” width=”some value” height=”some value”>

The attribute action of the form:

The form tag has a particular attribute which is the attribute “action”. This attribute is used to specify where the data collected through the form fields would be sent for processing. This attribute takes URLs as values. It is possible to specify if the new page will open a new tab or it will load in the same location (using the properties _self or _blank).

The attribute method of the form:

The form tag has another important attribute that specifies the used method to send the collected data to the processing page. This attribute is indeed the method attribute. It can take two values:

  • GET: this method has limited features. Yet it is suited for the packs with few variables, especially where there is no need for high security.
  • POST: this method is almost hidden. It passes the variables securely and they don’t display in the URL.

Conclusion:

The form can be considered as the particular interface where users can interact with the website. Indeed, in addition to the cited elements, developers consider the “file” type which allows browsing and uploading files. The developers can also create the search button, where they have to add some particular scripts to perform the search operation. It is important to know the difference between the two submitting methods that the form uses to send values to the processing page.