Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mrdevinmob/3414647 to your computer and use it in GitHub Desktop.
Save mrdevinmob/3414647 to your computer and use it in GitHub Desktop.
collection-json extension template options

Template Options

Support template data options by adding property attribute with an array of prompts and values. Additionally add a multiple property, which indicates multiple values are suppored if set to "true".

  1. Add an optional property to the data object: option (array of objects. prompt/value pair)
  2. Add an optional property to the data object: multiple (boolean). This property has no impact if option property is not set.
{ "collection" :
  {
    "version" : "1.0",
    "href" : "http://example.org/users",

    "template" : {
      "data" : [
        { "name" : "username", "value" : "", "prompt" : "User name", "required" : "true" },
        { "name" : "country", "value" : "", "prompt" : "Country", "multiple" : "false",  "options" : [ { "prompt" : "Germany", "value" : "de" }, { "prompt" : "Poland", "value" : "pl" } ] },
	{ "name" : "talents", "value" : "", "prompt" : "Talents", "required" : "true", "multiple" : "true",  "options" : [ { "prompt" : "Swimming", "value" : "swimming" }, { "prompt" : "Climbing", "value" : "climbing" }, { "prompt" : "Socializing", "value" : "socializing" } ] },
      ]
    }
  }
}

References

  1. https://groups.google.com/d/msg/collectionjson/PQK5PoB7eSI/-TQgtjFTeqsJ
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment