Skip to content
This repository has been archived by the owner on Jan 4, 2020. It is now read-only.

Adding Initial Values

Justin Stayton edited this page Aug 29, 2013 · 6 revisions

There are three ways to add initial values to an instance of Manifest.

Input value

If you're working with simple string values (as opposed to more complex values in JSON format), the initial values can be set as the value of the input field. Each value is split on the configured separator characters (by default, a comma) and trimmed. For example:

<input type="text" name="tags" id="tags" value="Baseball, Football, Running">

In this example, Baseball, Football, and Running are added to the list.

Input data-values

For more complex data in JSON format, an object or array of objects can be stored in the input field's data-values attribute:

<input type="text" name="recipients" id="recipients" data-values="{ &quot;name&quot;: &quot;Lindsay Weir&quot;, &quot;email&quot;: &quot;[email protected]&quot; }">

Important: Be sure to properly encode the string of JSON!

values Option

The third and final method is to specify the initial values in the values option:

$('#recipients').manifest({
  values: {
    name: 'Lindsay Weir',
    email: '[email protected]'
  }
});
Clone this wiki locally