12.09.2015 Views

Boot Camp

Web Authoring Boot Camp - StudioBast

Web Authoring Boot Camp - StudioBast

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Web Authoring <strong>Boot</strong> <strong>Camp</strong><br />

17<br />

HTML Forms<br />

HTML forms are used to pass data to a server, or to collect data to send in an email. You<br />

can use them, for instance, to get contact information from your visitors, and to elicit<br />

comments and opinions.<br />

A form can contain input elements like text fields, checkboxes, radio-buttons, submit<br />

buttons and more. It can also contain select lists, textarea, fieldset, legend, and label elements.<br />

Users generally complete a form by modifying its controls (entering text, selecting<br />

menu items, etc.), before submitting the form to an agent for processing (e.g., a Web<br />

server, a mail server, etc.) Some form of scripts (server-side, client-side, or both) must be<br />

used to process the visitor’s input once it is submitted.<br />

Users interact with forms through named controls. A control’s control name is given by its<br />

name attribute. The scope of the name attribute for a control within a form element is the<br />

form element. These elements are either block or inline elements, but are collected here<br />

as their use is more restricted than other inline or block elements.<br />

New HTML5 form attributes include autofocus, autocomplete, list, required, multiple,<br />

pattern, min and max, step, placeholder, numbers, times, telephone and color. At this time<br />

most are not supported at all or only by one or two browsers and versions, and none of<br />

the new form selectors are supported. I will mention useful HTML5 things in the context<br />

of the rest of the forms as appropriate.<br />

Form Methods<br />

In HTML, one can specify two different submission methods for a form using the method<br />

attribute. The two methods are post and get.<br />

• Post: Form data is to appear within a message body, and/or for anything like storing<br />

or updating data, or ordering a product, or sending email.<br />

• Get: Form data is to be encoded (by a browser) into a URL, and for getting (retrieving)<br />

data.<br />

Form Handlers<br />

In order to get a form working, it is not enough to just design the form itself. You also<br />

172

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!