HTML5, CSS3, and JavaScript Fourth Edition

(Ben Green) #1

CHAPTER 17. FORMS AND INPUTS 174


form is submitted.


17.2 Input Fields In General


Within the form, there can be any number of input fields. In order to be
transmitted, each has a name and a value.


There are three major types of input fields: input, textarea, and select. Each
type is covered in a section below.


Exam Question 307(p.354): List the three form input tags.
Required Answer:input, textarea, select


No matter which input type is used, it must have a name or data cannot be
sent back from the form.


It can also be designated byautofocusto receive the cursor when the page
is loaded. If more than one field has autofocus, the browser is free to choose
which field to use. You cannot rely on it being the first autofocus. It might
be the last or it might vary randomly.


And it can (probably) participate intaborder, which tells which field you
go to next when you press the tab key.


17.2.1 name=value


When your form is submitted, each input field is either transmitted as part
of the form or not transmitted.


We do not transmit the entire form. We do not transmit what you see.
Instead we transmit the bare minimum of information. For each field, we
transmit its name, which is part of the webpage itself, and we transmit its
value, which might be provided by the user.


The only thing that is transmitted isname=value.


17.2.2 The name= Parameter


Thenameparameter is used in every field.


The name parameter is not displayed to the user, but they can see it with
a “show page source” command.

Free download pdf