Skip to content

Instantly share code, notes, and snippets.

@alloy-d
Created October 2, 2012 17:03
Show Gist options
  • Save alloy-d/3821183 to your computer and use it in GitHub Desktop.
Save alloy-d/3821183 to your computer and use it in GitHub Desktop.
JSON representing comment fields for a blog on which identity is a name and a spirit animal.
[
{
"name": "commenter[name]", // the name attribute; should also be used to create the id
"text": "Your name (pseudonyms are okay)", // the text of an associated label
"required": true, // this field should not be left blank
}, // => A basic text field
{
"name": "commenter[email]",
"text": "Your email address (will not be shown)",
"type": "email", // this field represents an email address
"required": true,
}, // => A text field for an email address
{
"name": "commenter[spirit_animal]",
"text": "Your spirit animal (will be shown)",
"required": true,
"options": [ // a list of possible values for this field
{"text": "Caribou", "value": "sanimal01"},
{"text": "Duck-billed platypus", "value": "sanimal02"},
{"text": "Emu", "value": "sanimal03"},
{"text": "Lemur", "value": "sanimal50"},
{"text": "Testudo", "value": "sanimal70"},
{"text": "Zebra", "value": "sanimal99"}
]
}, // => A dropdown for spirit animals
{
"name": "comment",
"text": "Your comment (innocent HTML allowed)",
"long": true, // this is a long text field, not just a one-liner
"required": true,
"extra": { // extra info--should be appended in the form of data- attributes
"max-length": 500
}
} // => A comment box
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment