HTML Forms – Interactive HTML – Web 2.0
HTML – New types for input – Degrades gracefully for browsers that do not support the html 5 input types – Master the basics – For all others use a reference
Basics Form – … – A form can contain s such as text fields, checkboxes, radio-buttons, submit buttons – also lists,,,, and s Textbox – – short text input (word.. sentence) single-line input Textarea – – Can handle multi-line input, paragraph(s), memo
attributes Virtually everything needs a (unique) name attribute (there is an exception) – <form name=‘myform’ … – <input name=‘firstname’ … Needed to extract form data Value – <input value=‘initial’ … can be used to specify a default initial value on input elements
– type attribute specifies input method <input type=‘text’ renders a normal textbox <input type= ‘password’ renders a password field <input type= ‘radio’ renders a radio button – Use a common name value to group – Selecting one deselects others in the same group (same name) <input type=‘checkbox’ <input type=‘submit’ value=‘submit’ – Defines a submit button – Usually sends form data to server
New input types for html 5 – Color – Date – – Month – Number – Range – url – Week Unsupported types degrade to normal text fields
More Form elements Select (dropdown) list A B C Value attribute indicates what is sent to the server. Selected attribute can be used to set a default
Non-Essential Form Elements +