rest/forms-brainstorming: Difference between revisions

From Microformats Wiki
Jump to navigation Jump to search
(→‎Patterns: better)
Line 24: Line 24:
=== Complete Forms Design Pattern ===
=== Complete Forms Design Pattern ===


<form class="deth" action="http://somesite.com/users" method="post">
&lt;form class="deth" action="http://somesite.com/users" method="post">
&lt;ol>
  &lt;ol>
&lt;li>
  &lt;li>
<label for="firstname">First name:</label><input type="text" id="firstname" />
  &lt;label for="firstname">First name:&lt;/label>&lt;input type="text" id="firstname" />
  &lt;/li><li>
  &lt;/li>&lt;li>
<label for="lastname">Last name:</label><input type="text" id="lastname" />
    &lt;label for="lastname">Last name:&lt;/label>&lt;input type="text" id="lastname" />
  &lt;/li><li>
  &lt;/li>&lt;li>
   <input type="radio" name="sex" value="male">Male</input>
   &lt;input type="radio" name="sex" value="male">Male&lt;/input>
   <input type="radio" name="sex" value="female">Female</input>
   &lt;input type="radio" name="sex" value="female">Female&lt;/input>
  &lt;/li><li>
  &lt;/li>&lt;li>
   <input type="checkbox" name="travel" value="car">Car</input>
   &lt;input type="checkbox" name="travel" value="car">Car&lt;/input>
   <input type="checkbox" name="travel" value="bike">Bicycle</input>
   &lt;input type="checkbox" name="travel" value="bike">Bicycle&lt;/input>
  &lt;/li><li>
  &lt;/li>&lt;li>
<label for="age">Age:
  &lt;label for="age">Age:
<select>
  &lt;select>
     <option val=0>< 18</option>
     &lt;option val=0>< 18&lt;/option>
     <option val=18>18-64</option>
     &lt;option val=18>18-64&lt;/option>
     <option val=65>65+</option>
     &lt;option val=65>65+&lt;/option>
  &lt;/select>
  &lt;/select>
  &lt;/li><li>
  &lt;/li>&lt;li>
<label for="description">Description:</label>
  &lt;label for="description">Description:&lt;/label>
<textarea id="description">Default text</textarea>
  &lt;textarea id="description">Default text&lt;/textarea>
  &lt;/li>
  &lt;/li>
  &lt;/ol>
  &lt;/ol>
Line 51: Line 51:
  &lt;input type="reset" />
  &lt;input type="reset" />
  &lt;/form>
  &lt;/form>
&lt;/body>
&lt;/html>


=== Table Design Pattern ===
=== Table Design Pattern ===

Revision as of 04:05, 12 October 2005

Forms Brainstorming

This page collects ideas from forms-examples how to best encode form data into a microformat

DETH = Dictionaries Encoding/Transmitting HTML

Rules (Strawman)

  1. Only use XHTML Basic Forms Module
  2. Must use action with appropriate URI (no scripts)
  3. Recommend: use a label with every input
  4. Make the for of the label match the id of input
  5. Optionally, group label with input using or <li>
    1. If <li>, group input inside label
    2. If , place label in first , and input in second.
  6. Always place submit and reset outside grouping

Patterns

Anchor Design Pattern

<a class="deth" href="http//somesite.com/prog/adduser">label</a>

Complete Forms Design Pattern

<form class="deth" action="http://somesite.com/users" method="post">
 <ol>
 <li>
  <label for="firstname">First name:</label><input type="text" id="firstname" />
</li><li>
   <label for="lastname">Last name:</label><input type="text" id="lastname" />
</li><li>
  <input type="radio" name="sex" value="male">Male</input>
  <input type="radio" name="sex" value="female">Female</input>
</li><li>
  <input type="checkbox" name="travel" value="car">Car</input>
  <input type="checkbox" name="travel" value="bike">Bicycle</input>
</li><li>
 <label for="age">Age:
 <select>
   <option val=0>< 18</option>
   <option val=18>18-64</option>
   <option val=65>65+</option>
</select>
</li><li>
 <label for="description">Description:</label>
 <textarea id="description">Default text</textarea>
</li>
</ol>
<input type="submit" value="Send" />
<input type="reset" />
</form>

Table Design Pattern

<form class="deth" action="http//somesite.com/users" method="post">
<table class="form">
<tr>
 <td><label for="firstname">First name</label></td>
 <td><input type="text" id="firstname" /></td>
</tr><tr>
 <td><label for="lastname">Last name</label></td>
 <td><input type="text" id="lastname" /></td>
</tr><tr>
 <td><label for="email">Email</label></td>
 <td><input type="text" id="email" /></td>
</tr><tr>
 <td><label for="sex">Sex</label></td>
 <td>
   <input type="radio" name="sex" value="Male">Male </input>
   <input type="radio" name="sex" value="Female">Female </input>
 </td>
</tr><tr>
 <td><label for="travel">Travel</label></td>
 <td>
   <input type="checkbox" name="travel" value="car">Car</input>
   <input type="checkbox" name="travel" value="bike">Bicycle</input>
 </td>
</tr><tr>
 <td><label for="age">Age</label></td>
 <td><select>
    <option val=0>< 18 </option>
    <option val=18>18-64 </option>
    <option val=65>65+ </option>
 </td></select>
</tr>
</table>
<input type="submit" value="Send" />
<input type="reset" />
</form>

List Design Pattern

<form class="deth" action="http//somesite.com/users" method="post">
<ol>
<li>
 <label for="firstname">First name<input type="text" id="firstname" /></label>
</li><li>
 <label for="lastname">Last name<input type="text" id="lastname" /></label>
</li><li>
 <label for="email">Email<input type="text" id="email" /></label>
</li><li>
 <label for="sex">Sex  
   <input type="radio" name="sex" value="Male">Male </input>
   <input type="radio" name="sex" value="Female">Female </input>
 </label>
</li><li>
 <label for="travel">Travel  
   <input type="checkbox" name="travel" value="car">Car</input>
   <input type="checkbox" name="travel" value="bike">Bicycle</input>
 </label>
</li><li>
 <label for="age">Age
 <select>
    <option val=0>< 18 </option>
    <option val=18>18-64 </option>
    <option val=65>65+ </option>
 </select>
</label>
</li>
</ol>
<input type="submit" value="Send" />
<input type="reset" />
</form>