update to version 1.6 of jquery.tokeninput.js and fix problem with reloading EmailsField pages by adding a data-pre attribute instead of hacking the value attribute - Legacy-Id: 8264
20 lines
603 B
JavaScript
20 lines
603 B
JavaScript
function setupTokenizedField(field) {
|
|
if (field.parents(".template").length > 0)
|
|
return; // don't tokenize hidden template snippets
|
|
|
|
var pre = [];
|
|
if (field.attr("data-pre"))
|
|
pre = JSON.parse((field.attr("data-pre") || "").replace(/"/g, '"'));
|
|
|
|
field.tokenInput(field.attr("data-ajax-url"), {
|
|
hintText: "",
|
|
preventDuplicates: true,
|
|
prePopulate: pre,
|
|
tokenLimit: field.attr("data-max-entries")
|
|
});
|
|
}
|
|
|
|
jQuery(function () {
|
|
jQuery(".tokenized-field").each(function () { setupTokenizedField(jQuery(this)); });
|
|
});
|