diff --git a/tildes/static/js/behaviors/autocomplete-input.js b/tildes/static/js/behaviors/autocomplete-input.js index 52981a1..5d6cca1 100644 --- a/tildes/static/js/behaviors/autocomplete-input.js +++ b/tildes/static/js/behaviors/autocomplete-input.js @@ -37,6 +37,13 @@ $.onmount('[data-js-autocomplete-input]', function() { $.onmount(); } + // initialization (won't repeat on re-mounts because it removes the name attr) + if ($(this).attr("name")) { + // move the "tags" name to the hidden input (so the form works without JS) + $(this).removeAttr("name"); + $("[data-js-autocomplete-hidden-input]").attr("name", "tags"); + } + if ($(this).val() !== '') { addChip($(this)); } diff --git a/tildes/tildes/templates/macros/forms.jinja2 b/tildes/tildes/templates/macros/forms.jinja2 index 5d4be73..2448bb6 100644 --- a/tildes/tildes/templates/macros/forms.jinja2 +++ b/tildes/tildes/templates/macros/forms.jinja2 @@ -32,7 +32,7 @@ autocomplete="off" autocapitalize="none" spellcheck="false" - name="query" + name="tags" placeholder='Tags (like "music, soundtrack, full album")' data-js-autocomplete-input='{{ autocomplete_options|tojson if autocomplete_options }}' {% if value %} value="{{ value }}"{% endif %} @@ -40,7 +40,7 @@ >
- + {% endmacro %}