Skip to content

Instantly share code, notes, and snippets.

@mikekelly
Last active May 9, 2016 22:30
Show Gist options
  • Save mikekelly/5086339 to your computer and use it in GitHub Desktop.
Save mikekelly/5086339 to your computer and use it in GitHub Desktop.
what forms could look like in halo
# Form Properties
title
description
target
method
headers
fields
fielsets ??
# Shared Field Properties
type
validators
title
help
# Field Types
Text
Number
Password
TextArea
Checkbox
Checkboxes
Hidden
Select
Radio
Date
DateTime
List
Object
# Field Validators
required
email
url
match
regexp
{
"_links": { "self": { "href": "/users" } },
"_forms": {
"create-user": {
"title": "Create a new widget",
"description": "Enter your widget info and submit to create a new widget",
"target": "/widgets/{id}",
"method": "PUT",
"headers": {
"Content-Type": "application/json"
},
"fields": {
"name": { "type": "Text", "validators": [ "required" ] },
"email": { "type": "Text", "validators": [ "required", "email" ] },
"age": { "type": "Number" },
"homepage": { "type": "Text", "dataType": "url", "validators": [ "url" ] },
"password": { "type": "Password" },
"likes": { "type": "Checkboxes", "options": [ "Computers", "Combat", "Cats" ] },
"ninja": { "type": "Hidden", "value": "This is a hidden field" },
"size": { "type": "Select", "options": [ "large", "small" ] },
"has_answer": { "type": "Radio", "options": [ "yes", "no", "wtf" ] },
"dob": { "type": "Date" },
"favourite_datetime": { "type": "DateTime" },
"things_to_do_before_death": { "type": "List" }
}
}
}
}
@fosdev
Copy link

fosdev commented May 17, 2013

@mikekelly Presume you are aware of this: http://tools.ietf.org/html/rfc6861. I think it would be useful to consider accommodating this so that one could actually externally define the form and thus look it up as you are working on controls for HALO. Given there is a spec and per my earlier comment on keeping things DRY, this would be a nice option to be able to use as well as whatever the full convention ends up being.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment