From 405313d551dc6e398887716a2889f19d51f0375b Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Wed, 18 Jan 2017 12:42:23 +0100 Subject: [PATCH] jQuery-resetForm() anstelle von selbst geschriebenem Reset-Code nutzen MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Unsere bisherigen Reset-Implementationen haben die Inputs alle auf leer gesetzt. Die Standard-Reset-Routinen der Browser setzen die Inputs allerdings auf ihren Zustand zurück, den sie beim Laden hatten, was auch mehr Sinn ergibt. --- templates/webpages/background_job_history/_filter.html | 4 ++-- templates/webpages/bank_transactions/_filter.html | 5 ++--- templates/webpages/bank_transactions/assign_invoice.html | 9 ++------- templates/webpages/delivery_plan/_filter.html | 4 +--- templates/webpages/delivery_value_report/_filter.html | 7 ++----- templates/webpages/email_journal/_filter.html | 4 ++-- .../webpages/financial_controlling_report/_filter.html | 6 ++---- templates/webpages/order/tabs/_multi_items_dialog.html | 2 +- templates/webpages/part/_multi_items_dialog.html | 2 +- templates/webpages/project/_filter.html | 2 ++ templates/webpages/project/search.html | 2 +- templates/webpages/record_links/add_filter.html | 9 ++------- 12 files changed, 20 insertions(+), 36 deletions(-) diff --git a/templates/webpages/background_job_history/_filter.html b/templates/webpages/background_job_history/_filter.html index 862acbcd8..ebcd06a31 100644 --- a/templates/webpages/background_job_history/_filter.html +++ b/templates/webpages/background_job_history/_filter.html @@ -1,5 +1,5 @@ [%- USE L %][%- USE LxERP %][%- USE HTML %] -
+
[% LxERP.t8('Show Filter') %] [% IF SELF.filter_summary %]([% LxERP.t8("Current filter") %]: [% SELF.filter_summary %])[% END %] @@ -40,7 +40,7 @@ [% L.hidden_tag('page', FORM.page) %] [% L.submit_tag('action_list', LxERP.t8('Continue'))%] - [% LxERP.t8('Reset') %] + [% L.button_tag("\$('#filter_form').resetForm();", LxERP.t8('Reset')) %]
diff --git a/templates/webpages/bank_transactions/_filter.html b/templates/webpages/bank_transactions/_filter.html index 0aaab1417..3eb2d0a35 100644 --- a/templates/webpages/bank_transactions/_filter.html +++ b/templates/webpages/bank_transactions/_filter.html @@ -2,7 +2,7 @@ [%- USE L %] [%- USE LxERP %] [%- USE HTML %] - +
[% 'Show Filter' | $T8 %] [% SELF.filter_summary | html %] @@ -68,8 +68,7 @@ [% L.input_tag('action_list_all', LxERP.t8('Continue'), type = 'submit', class='submit')%] -[% 'Reset' | $T8 %] - +[% L.button_tag('$("#filter_form").resetForm()', LxERP.t8('Reset')) %]
diff --git a/templates/webpages/bank_transactions/assign_invoice.html b/templates/webpages/bank_transactions/assign_invoice.html index ea71ae7b0..967a1eaf1 100644 --- a/templates/webpages/bank_transactions/assign_invoice.html +++ b/templates/webpages/bank_transactions/assign_invoice.html @@ -2,7 +2,7 @@ [% SET debug = 0 %] -
+ [%- LxERP.t8("Bank transaction") %]: @@ -56,7 +56,7 @@

[% L.submit_tag('', LxERP.t8("Search")) %] [% L.button_tag('add_selected_invoices()', LxERP.t8("Add invoices"), id='add_selected_record_links_button') %] - [%- LxERP.t8("Reset") %] + [% L.button_tag('$("#assign_invoice_window_form").resetForm()', LxERP.t8('Reset')) %] [% LxERP.t8("Cancel") %]

@@ -95,14 +95,9 @@ function add_selected_invoices() { }); } -function assign_invoice_reset_form() { - $('#assign_invoice_window form input[type=text]').val(''); -} - $(function() { $('#invnumber').focus(); }); //--> - diff --git a/templates/webpages/delivery_plan/_filter.html b/templates/webpages/delivery_plan/_filter.html index fbdb9e49b..861fef6c3 100644 --- a/templates/webpages/delivery_plan/_filter.html +++ b/templates/webpages/delivery_plan/_filter.html @@ -102,9 +102,7 @@ [% L.hidden_tag('mode', SELF.mode) %] [% L.input_tag('action_list', LxERP.t8('Continue'), type = 'submit', class='submit')%] - -[% 'Reset' | $T8 %] - +[% L.button_tag('$("#filter_form").resetForm()', LxERP.t8('Reset')) %] diff --git a/templates/webpages/delivery_value_report/_filter.html b/templates/webpages/delivery_value_report/_filter.html index fdac6226a..c65ae0f0f 100644 --- a/templates/webpages/delivery_value_report/_filter.html +++ b/templates/webpages/delivery_value_report/_filter.html @@ -2,7 +2,7 @@ [%- USE L %] [%- USE LxERP %] [%- USE HTML %] - +
[% 'Show Filter' | $T8 %] [% SELF.filter_summary | html %] @@ -94,10 +94,7 @@ [% L.hidden_tag('page', FORM.page) %] [% L.hidden_tag('vc', SELF.vc) %] [% L.input_tag('action_list', LxERP.t8('Continue'), type = 'submit', class='submit')%] - - -[% 'Reset' | $T8 %] - +[% L.button_tag('$("#filter_form").resetForm()', LxERP.t8('Reset')) %]
diff --git a/templates/webpages/email_journal/_filter.html b/templates/webpages/email_journal/_filter.html index 282fd0980..fe46ff356 100644 --- a/templates/webpages/email_journal/_filter.html +++ b/templates/webpages/email_journal/_filter.html @@ -1,5 +1,5 @@ [%- USE L %][%- USE LxERP %][%- USE HTML %] - +
[% LxERP.t8('Show Filter') %] [% IF SELF.filter_summary %]([% LxERP.t8("Current filter") %]: [% SELF.filter_summary %])[% END %] @@ -36,7 +36,7 @@ [% L.hidden_tag("page", FORM.page) %] [% L.submit_tag("action_list", LxERP.t8("Continue"))%] - [% LxERP.t8("Reset") %] + [% L.button_tag('$("#filter_form").resetForm()', LxERP.t8('Reset')) %]
diff --git a/templates/webpages/financial_controlling_report/_filter.html b/templates/webpages/financial_controlling_report/_filter.html index 3876cff3b..bdff2082b 100644 --- a/templates/webpages/financial_controlling_report/_filter.html +++ b/templates/webpages/financial_controlling_report/_filter.html @@ -3,7 +3,7 @@ [%- USE LxERP %] [%- USE HTML %] [%- SET style='width: 400px' %] - +
[% 'Show Filter' | $T8 %] [% SELF.filter_summary %] @@ -50,9 +50,7 @@ [% L.hidden_tag('sort_dir', FORM.sort_dir) %] [% L.hidden_tag('page', FORM.page) %] [% L.input_tag('action_list', LxERP.t8('Continue'), type = 'submit', class='submit')%] - - -[% 'Reset' | $T8 %] +[% L.button_tag('$("#filter_form").resetForm()', LxERP.t8('Reset')) %]
diff --git a/templates/webpages/order/tabs/_multi_items_dialog.html b/templates/webpages/order/tabs/_multi_items_dialog.html index d1514e0aa..dafe6baa3 100644 --- a/templates/webpages/order/tabs/_multi_items_dialog.html +++ b/templates/webpages/order/tabs/_multi_items_dialog.html @@ -12,7 +12,7 @@
[% L.button_tag('update_result()', LxERP.t8('Filter')) %] -[% 'Reset' | $T8 %] +[% L.button_tag('$("#multi_items_form").resetForm()', LxERP.t8('Reset')) %]
diff --git a/templates/webpages/part/_multi_items_dialog.html b/templates/webpages/part/_multi_items_dialog.html index 02bf33ae9..f04012f32 100644 --- a/templates/webpages/part/_multi_items_dialog.html +++ b/templates/webpages/part/_multi_items_dialog.html @@ -14,7 +14,7 @@ [% L.button_tag('update_result()', LxERP.t8('Filter')) %] -[% 'Reset' | $T8 %] +[% L.button_tag('$("#multi_items_form").resetForm()', LxERP.t8('Reset')) %]
diff --git a/templates/webpages/project/_filter.html b/templates/webpages/project/_filter.html index 3bd198052..90a15d0fb 100644 --- a/templates/webpages/project/_filter.html +++ b/templates/webpages/project/_filter.html @@ -53,3 +53,5 @@ + +[% L.button_tag('$("#search_form").resetForm()', LxERP.t8('Reset')) %] diff --git a/templates/webpages/project/search.html b/templates/webpages/project/search.html index 7e6cdeea4..ad706a46a 100644 --- a/templates/webpages/project/search.html +++ b/templates/webpages/project/search.html @@ -6,7 +6,7 @@ [%- INCLUDE 'common/flash.html' %] - +

[%- INCLUDE 'project/_filter.html' %] diff --git a/templates/webpages/record_links/add_filter.html b/templates/webpages/record_links/add_filter.html index b2ee69155..04346b5f0 100644 --- a/templates/webpages/record_links/add_filter.html +++ b/templates/webpages/record_links/add_filter.html @@ -3,7 +3,7 @@

[%- LxERP.t8("Add link: select records to link with") %]

- + [% L.hidden_tag('object_model', SELF.object_model) %] [% L.hidden_tag('object_id', SELF.object_id) %] @@ -45,7 +45,7 @@

[% L.button_tag('filter_record_links()', LxERP.t8("Search")) %] [% L.button_tag('add_selected_record_links()', LxERP.t8("Add links"), id='add_selected_record_links_button', disabled=1) %] - [%- LxERP.t8("Reset") %] + [% L.button_tag('$("#record_links_add_filter_form").resetForm()', LxERP.t8('Reset')) %] [% LxERP.t8("Cancel") %]

@@ -63,11 +63,6 @@ $(function() { record_links_change_form_to_match_type(); }); -function record_links_reset_form() { - $('#record_links_add form input[type=text]').val(''); - $('#record_links_add form select').prop('selectedIndex', 0); -} - function filter_record_links() { var url="controller.pl?action=RecordLinks/ajax_add_list&" + $("#record_links_add form").serialize(); $.ajax({ -- 2.20.1