Cascading Style Sheets HTML Forms form element All fields associated with form a encapsulated Allows for multiple forms on one page (sign-up or sign-in) Controls how/where data is processed
Cascading Style Sheets Forms attributes <form action='process.php' method='get'> This form would send data to process.php The method specifies how the data should be sent GET vs. POST query string vs. posted data process.php?user=jon.doe&password=pass
Cascading Style Sheets Forms labels & ids <label for='un'>User Name:</label> <input type='text' name='user' id='un'><br> Label is associated with form field for => id Allows label to describe the field Has another subtle impact
Cascading Style Sheets Forms name attribute <form action='process.php' method='get'> <label for='un'>User Name:</label> <input type='text' name='user' id='un'><br> <label for='pwd'>Password:</label> <input type='password' name='pass' id='pwd'><br> <input type='submit'> </form> The ‘name’ attribute is used for processing data name = jon.doe
Cascading Style Sheets Forms buttons <input type='submit'> Standard “submit” button <input type='reset'> Button to “reset” the form <input type='button'> Button which has no action <input type='image'> Image with button properties
Cascading Style Sheets Forms checkboxes <label>Check this: <input type='checkbox'></label> Encapsulating with label tags, no ID? Allows for multiple selections for items with the same name
Cascading Style Sheets Forms radio input <label>Check this: <input type='radio'></label> Labels again! Allows for single selection for items with the same name
Cascading Style Sheets Forms options + option groups <option value=''>Choose One</option> <optgroup label='Warm'> <option value='#F00'>Red</option> <option>Pink</option> </optgroup> Options are selectable and assign value Option groups divide options and cannot be selected Value can be different from text
Cascading Style Sheets Forms textarea <textarea name='txt' rows='5'>Default Text</textarea> Used for blocks of text (multiple lines) Rows control number of lines visible Cols control width measured by number of characters (ems). Use CSS. No value attribute, default value is within tags