Jump to: navigation, search


Forms Brainstorming

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

Proposal A: 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. Group label with input using
  6. Always place submit and reset outside grouping

Questions for further research

  1. How to specify whether a field is optional or required?
    1. Suggestion: the label contains a * ?


Anchor Design Pattern

<a class="deth" href="http//">label</a>

Forms Design Pattern

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

Sample Python Binding

 "firstname","lastname","sex",'"travel", "age","description"
 "firstname":"First name:",
 "lastname":"Last name:",
 "sex":{"@type":"radio", "male":"Male", "female":"Female"},
 "travel":{"@type":"checkbox", "car":"Car", "bike":"Bicycle"},
 "age":{"@@body":"Age:", "@type":"select",
        "0":"< 18", "18":"18-64", "65":"65+"
   "@value":"Default text"

Proposal B: REST-oriented process

From [Kyle Cordes], for the discovery of the parameters:

parameters can be passed in that POST. In some cases, it will use <selects>s to describe what options are valid for a parameter.

to explain the meaning of the parameters (a machine-understandable way to explain parameter meaning, sounds like an AI problem...)

programmatically using the server) populate the parameters and POST them to the URL you discovered via the form.

parameter problem, or might be a respresentation of the "answer".

[OlaBerg] says: This is exactly what I do, and it works great! In fact, I use it both for POST-API and GET-API. A set of forms defines a REST-ful API.

See Also

rest/forms-brainstorming was last modified: Thursday, September 16th, 2010