datatracker/static/js/tokenized-field.js
Ole Laursen a1a13323d2 Use hint text instead of Django help text for providing the help for
EmailsField and clarify the text displayed when the input is invalid
so it's hopefully more clear what happens
 - Legacy-Id: 8272
2014-08-17 09:02:21 +00:00

21 lines
690 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"), {
preventDuplicates: true,
prePopulate: pre,
tokenLimit: field.attr("data-max-entries"),
noResultsText: "No results - cannot use this entry",
hintText: field.attr("data-hint-text")
});
}
jQuery(function () {
jQuery(".tokenized-field").each(function () { setupTokenizedField(jQuery(this)); });
});