rest/forms-brainstorming: Difference between revisions
Jump to navigation
Jump to search
(→Forms Brainstorming: removed older examples) |
|||
| Line 51: | Line 51: | ||
<input type="reset" /> | <input type="reset" /> | ||
</form> | </form> | ||
== Sample Python Binding == | |||
order=[ | |||
"firstname","lastname","sex",'"travel", "age","description" | |||
] | |||
dict={ | |||
"@@tag":"form", | |||
"@action":"http://somesite.com/users/", | |||
"@class":"deth", | |||
"@enctype":"application/x-www-form-urlencoded", | |||
"@method":"post", | |||
"@@order":order, | |||
"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+" | |||
}, | |||
"description":{ | |||
"@@body":"Description:", | |||
"@type":"textarea", | |||
"@value":"Default text" | |||
} | |||
} | |||
Revision as of 04:07, 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)
- Only use XHTML Basic Forms Module
- Must use action with appropriate URI (no scripts)
- Recommend: use a label with every input
- Make the for of the label match the id of input
- Optionally, group label with input using or <li>
- If <li>, group input inside label
- If , place label in first , and input in second.
- Always place submit and reset outside grouping
Patterns
Anchor Design Pattern
<a class="deth" href="http//somesite.com/prog/adduser">label</a>
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>
Sample Python Binding
order=[
"firstname","lastname","sex",'"travel", "age","description"
]
dict={
"@@tag":"form",
"@action":"http://somesite.com/users/",
"@class":"deth",
"@enctype":"application/x-www-form-urlencoded",
"@method":"post",
"@@order":order,
"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+"
},
"description":{
"@@body":"Description:",
"@type":"textarea",
"@value":"Default text"
}
}