From 9de9c530fe7e48379f0ba0d49ca8e576975728bc Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Thu, 31 May 2018 19:24:28 +0200 Subject: Widget: add a restore button on inadequate clean of a value --- ishtar_common/templates/blocks/JQueryAutocomplete.js | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'ishtar_common/templates/blocks/JQueryAutocomplete.js') diff --git a/ishtar_common/templates/blocks/JQueryAutocomplete.js b/ishtar_common/templates/blocks/JQueryAutocomplete.js index 53a5e18ae..2d2bbad9d 100644 --- a/ishtar_common/templates/blocks/JQueryAutocomplete.js +++ b/ishtar_common/templates/blocks/JQueryAutocomplete.js @@ -23,6 +23,13 @@ $(function() { $('#id_select_{{field_id}}').val(null); }); + $(document).on("click", '#id_{{field_id}}_previous_button', function(){ + $('#id_{{field_id}}').val($('#id_{{field_id}}_previous').val()); + $('#id_select_{{field_id}}').val( + $('#id_{{field_id}}_previous_label').html() + ); + $('#id_{{field_id}}').change(); + }); {% if dynamic_limit %}{% for item_id in dynamic_limit %} $('#{{item_id}}').change(function(){ -- cgit v1.2.3