Google+ logo Twitter logo Youtube logo

Tags - Formelements


A "form"?

A form is a section where site visitors can enter information. Typically, anywhere (on any website) where you can type something in or choose something. It's done with forms. A form can be announced with a <form> tag. Within this tag, several form-elements, which gives the visitor the ability to e.g. type something in.

Input

Actually, we're asking the visitor for his/her input. There are many different ways to gather input, we will focus on typing something in and choosing something.

Typing something

Through the <input> tag can ask the visitor for his/her input. As previously stated, all tags have their own attributes. For each <input> tag, we can "tell" whether it is a choice or a text (typing something in) using the attribute type.

In a <input> tag, we announce the option "typing something in" with attribute-value text for attribute type, something like this;


  • <input> is a tag
  • type is a attribute
  • text is a attribute-value

The line of HTML results in the textfield underneath, type something in!
Type something:

Choosing something

We cay also ask the visitor to make a choice. Because this is user-input, we use the same <input> tag. However, we use a different attribute value for the attribute type, namely: radio. Suppose, we want to ask the visitor if he/she wants to drink something, it could look like this;

Do you want a drink?  Yes  No 
The HTML above results in;

Do you want a drink? Yes No

The "form-tag"

We just learned howto ask a visitor for his/her input.

  • We can let visitors choose something with attribute-value radio for attribute type.
  • We can let visitors type something in with attribute-value text for attribute type.
With a <form> tag, we're able to "group" these input-tags. Say; we create a form for contactrequest, it could look like this;
What's your name?
Shall we call you? Yes No
The <form> tag makes sure that the "questions" are nice and grouped. In the example above, we can see that all the "questions" are grouped in one form, this form represents the whole contactrequest.


Leave a comment ...

Name (will be visible)
E-mailaddress (will not be shown)
Comment
Type the code illustrated below

Back to top