Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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