Home

Awesome

NOTICE: This project is deprecated and no longer maintained. If you'd like to continue supporting a forked version, please reach out on Twitter (@kidjustino) to have it listed here.

Manifest

Selenium Test Status Build Status

A jQuery plugin that adds delight to selecting multiple values for an input.

The recipients field in an email app is a perfect example. You could just offer a plain text input, requiring the user to manually separate each recipient with a comma. Removing a recipient, however, is a pain: the user has to precisely select just the right amount of text, making sure not to accidentally remove too much or too little. As a discerning developer, you know the user experience should be better. And it can be, with Manifest.

Developed by Justin Stayton while at Monk Development.

Features

What About Chosen?

Chosen is a great plugin for jQuery and Prototype that, while similar to Manifest, is different in a number of ways:

Chosen and Manifest were designed for different cases. If you want to make a <select> element with a lot of options more user-friendly, use Chosen. If you can't reasonably list out every possible option (like all users in a system), or you need to allow arbitrary values (like new tags), use Manifest.

Requirements

Installation

Download

Bower

Bower is a package manager for the web. Once installed, Bower can install Manifest with a single command:

bower install jquery-manifest

Manually

Include

Include both jQuery and Manifest in your HTML:

<script src="jquery.min.js"></script>
<script src="jquery.manifest.min.js"></script>

In most cases, jquery.manifest.min.js is the best file to include, as it contains the required libraries and source code in a single minified package.

If Marco Polo is already being used separately, build/parts/jquery.manifest.min.js can be included to prevent duplicate, unnecessary code.

The build directory contains a number of other files as well:

Getting Started

To start, add a text input, if you haven't already:

<input type="text" id="recipients" name="recipients">

Then attach Manifest to the text input in your JavaScript:

$('#recipients').manifest({
  marcoPolo: {
    url: '/contacts/search',
    formatItem: function (data) {
      return '"' + data.name + '" (' + data.email + ')';
    }
  }
});

Notice the marcoPolo option object. Marco Polo powers the autocomplete functionality within Manifest, and the option object allows any of Marco Polo's options to be configured through Manifest. Be sure to read through Marco Polo's documentation for how it works and what's possible, including details on returning results in JSON format from your data source url. If you don't require autocomplete functionality, simply set the marcoPolo option to false.

Once you have autocomplete results working through Marco Polo, select a few of those results for submission. Manifest stores each item value in an array named after the text input. In the case of this example, the input's name is recipients, so the array of values is named recipients_values. If you dump the values of this array in PHP ($_POST['recipients_values']), the results will look something like this:

Array
(
    [0] => "Lindsay Weir" (lweir65@gmail.com)
    [1] => "Bill Haverchuck" (chuckle@yahoo.com)
    [2] => "Daniel Desario" (ddesario@me.com)
)

Loop through the array and process each value as necessary.

You should now have enough understanding of Manifest to start configuring it for your specific needs. And when you're ready, consider reading through some of the more advanced guides:

Options

Callbacks

Formatting

Events

Methods

Feedback

Please open an issue to request a feature or submit a bug report. Or even if you just want to provide some feedback, I'd love to hear. I'm also available on Twitter as @kidjustino.

Contributing

  1. Fork it.
  2. Create your feature branch (git checkout -b my-new-feature).
  3. Commit your changes (git commit -am 'Added some feature').
  4. Push to the branch (git push origin my-new-feature).
  5. Create a new Pull Request.