Fixed a problem with mismatched attribute names for ajax form field autocompletes. Closes issue #1049.

- Legacy-Id: 5771
This commit is contained in:
Henrik Levkowetz 2013-06-01 21:22:06 +00:00
parent 5bee7ac538
commit b7246168bf
4 changed files with 5 additions and 5 deletions

View file

@ -42,5 +42,5 @@ Change the document shepherd for {{ doc.name }}-{{ doc.rev }}
{% endblock %}
{% block content_end %}
<script type="text/javascript" src="/js/lib/jquery.tokeninput.js"></script>
<script type="text/javascript" src="/js/emails-field.js"></script>
<script type="text/javascript" src="/js/tokenized-field.js"></script>
{% endblock %}

View file

@ -26,7 +26,7 @@
</tr>
<tr class="docs">
<td>Drafts:</td>
<td><input name="{{ form.docs.html_name }}" class="tokenized-field" data-ajaxurl="{% url wg_ajax_search_docs group.acronym %}" data-pre="{{ form.docs_prepopulate }}"/>
<td><input name="{{ form.docs.html_name }}" class="tokenized-field" data-ajax-url="{% url wg_ajax_search_docs group.acronym %}" data-pre="{{ form.docs_prepopulate }}"/>
{{ form.docs.errors }}
</td>
</tr>

View file

@ -1,10 +1,10 @@
jQuery(function () {
jQuery(".emails-field").each(function () {
jQuery(".tokenized-field").each(function () {
var e = jQuery(this);
var pre = [];
if (e.val())
pre = JSON.parse(e.val());
e.tokenInput(e.data("ajax-url"), {
e.tokenInput(e.data("data-ajax-url"), {
hintText: "",
preventDuplicates: true,
prePopulate: pre

View file

@ -8,7 +8,7 @@ function setupTokenizedField(field) {
else if (field.data("pre"))
pre = JSON.parse((field.attr("data-pre") || "").replace(/&quot;/g, '"'));
field.tokenInput(field.data("ajaxurl"), {
field.tokenInput(field.attr("data-ajax-url"), {
hintText: "",
preventDuplicates: true,
prePopulate: pre