Beginning Web Programming - Code Examples

Back to main book index

Chapter 5: Forms

Here are the examples for Chapter 5, which looks at how to create forms to collect data from users.

ch05-eg01.htmlA simple search form with a text input and submit button

Form Controls

ch05-eg02.htmlSingle line text input control using the <input> element
ch05-eg03.htmlPassword input control using the <input> element
ch05-eg04.htmlMulti-line text input control using the <textarea> element
ch05-eg05.htmlCreating buttons using the <input> element
ch05-eg06.htmlCreating buttons using the <button> element
ch05-eg07.htmlCreating checkboxes using the <input> element
ch05-eg08.htmlCreating radio buttons using the <input> element
ch05-eg09.htmlCreating a drop down select box using the <select> element
ch05-eg10.htmlCreating scrolling select box using the <select> element and the size attribute
ch05-eg11.htmlSelect boxes with the multiple attribute
ch05-eg12.htmlGrouping options with the <optgroup> element
ch05-eg13.htmlGrouping options with a disabled <option> element
ch05-eg14.htmlCreating a file upload box using the <input> element
ch05-eg15.htmlCreating a hidden form control using the <input> element
Try it outA registration form

Labelling and Organising Forms

ch05-eg16.htmlUsing the <label> Element
ch05-eg17.htmlOrganising Form Controls with <fieldset> and <legend> Elements
ch05-eg18.htmlAn Example of Tabbing Order using the tabindex attribute
ch05-eg19.htmlUsing the accesskey Attribute
Try It OutExtending the registration form

Exercises

Exercise 1An email form
Exercise 2A voting form