]> wagnertech.de Git - kivitendo-erp.git/commitdiff
jQuery-resetForm() anstelle von selbst geschriebenem Reset-Code nutzen
authorMoritz Bunkus <m.bunkus@linet-services.de>
Wed, 18 Jan 2017 11:42:23 +0000 (12:42 +0100)
committerMoritz Bunkus <m.bunkus@linet-services.de>
Wed, 18 Jan 2017 11:42:23 +0000 (12:42 +0100)
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.

12 files changed:
templates/webpages/background_job_history/_filter.html
templates/webpages/bank_transactions/_filter.html
templates/webpages/bank_transactions/assign_invoice.html
templates/webpages/delivery_plan/_filter.html
templates/webpages/delivery_value_report/_filter.html
templates/webpages/email_journal/_filter.html
templates/webpages/financial_controlling_report/_filter.html
templates/webpages/order/tabs/_multi_items_dialog.html
templates/webpages/part/_multi_items_dialog.html
templates/webpages/project/_filter.html
templates/webpages/project/search.html
templates/webpages/record_links/add_filter.html

index 862acbcd8dd5f9ef5e96ab104d43ca332177abaf..ebcd06a31395d1228d73f237ea29640c2d2618ce 100644 (file)
@@ -1,5 +1,5 @@
 [%- USE L %][%- USE LxERP %][%- USE HTML %]
-<form action="controller.pl" method="post">
+<form action="controller.pl" method="post" id="filter_form">
  <div class="filter_toggle">
   <a href="#" onClick="javascript:$('.filter_toggle').toggle()">[% LxERP.t8('Show Filter') %]</a>
   [% 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'))%]
 
-  <a href="#" onClick="javascript:$('#filter_table input,#filter_table select').val('');">[% LxERP.t8('Reset') %]</a>
+  [% L.button_tag("\$('#filter_form').resetForm();", LxERP.t8('Reset')) %]
 
  </div>
 
index 0aaab14175ede4f9b0a10eed4dc9395825813aab..3eb2d0a3588381b03a19fb44279223df906dc5d8 100644 (file)
@@ -2,7 +2,7 @@
 [%- USE L %]
 [%- USE LxERP %]
 [%- USE HTML %]
-<form action='controller.pl' method='post'>
+<form action='controller.pl' method='post' id='filter_form'>
 <div class='filter_toggle'>
 <a href='#' onClick='javascript:$(".filter_toggle").toggle()'>[% 'Show Filter' | $T8 %]</a>
   [% SELF.filter_summary | html %]
@@ -68,8 +68,7 @@
 [% L.input_tag('action_list_all', LxERP.t8('Continue'), type = 'submit', class='submit')%]
 
 
-<a href='#' onClick='javascript:$("#filter_table input").val("");$("#filter_table input[type=checkbox]").prop("checked", 0);'>[% 'Reset' | $T8 %]</a>
-
+[% L.button_tag('$("#filter_form").resetForm()', LxERP.t8('Reset')) %]
 </div>
 
 </form>
index ea71ae7b0b02f55afc01b813d97514b035f392af..967a1eaf1f02366620e360860a8215b8fe5713bd 100644 (file)
@@ -2,7 +2,7 @@
 
 [% SET debug = 0 %]
 
-<form method="post" action="javascript:filter_invoices();">
+<form method="post" action="javascript:filter_invoices();" id="assign_invoice_window_form">
   <b>[%- LxERP.t8("Bank transaction") %]:</b>
   <table>
    <tr class="listheading">
@@ -56,7 +56,7 @@
   <p>
    [% L.submit_tag('', LxERP.t8("Search")) %]
    [% L.button_tag('add_selected_invoices()', LxERP.t8("Add invoices"), id='add_selected_record_links_button') %]
-   <a href="#" onclick="assign_invoice_reset_form();">[%- LxERP.t8("Reset") %]</a>
+   [% L.button_tag('$("#assign_invoice_window_form").resetForm()', LxERP.t8('Reset')) %]
    <a href="#" onclick="$('#assign_invoice_window').dialog('close');">[% LxERP.t8("Cancel") %]</a>
   </p>
 
@@ -95,14 +95,9 @@ function add_selected_invoices() {
   });
 }
 
-function assign_invoice_reset_form() {
-  $('#assign_invoice_window form input[type=text]').val('');
-}
-
 $(function() {
   $('#invnumber').focus();
 });
 
 //-->
 </script>
-
index fbdb9e49b99276b9155def7d9843bc0a9740a6f6..861fef6c3176a17fae7963f6fcefd5020150e02a 100644 (file)
 [% L.hidden_tag('mode', SELF.mode) %]
 [% L.input_tag('action_list', LxERP.t8('Continue'), type = 'submit', class='submit')%]
 
-
-<a href='#' onClick='javascript:$("#filter_table input").val("");$("#filter_table input[type=checkbox]").prop("checked", 0);$("#filter_table select").prop("selectedIndex", 0);'>[% 'Reset' | $T8 %]</a>
-
+[% L.button_tag('$("#filter_form").resetForm()', LxERP.t8('Reset')) %]
 </div>
 
 </form>
index fdac6226a62f1c779451321080cfb4c894bc7aa3..c65ae0f0fbf0335c233010b9d3f4881060d77ed8 100644 (file)
@@ -2,7 +2,7 @@
 [%- USE L %]
 [%- USE LxERP %]
 [%- USE HTML %]
-<form action='controller.pl' method='post'>
+<form action='controller.pl' method='post' id='filter_form'>
 <div class='filter_toggle'>
 <a href='#' onClick='javascript:$(".filter_toggle").toggle()'>[% 'Show Filter' | $T8 %]</a>
   [% SELF.filter_summary | html %]
 [% L.hidden_tag('page', FORM.page) %]
 [% L.hidden_tag('vc', SELF.vc) %]
 [% L.input_tag('action_list', LxERP.t8('Continue'), type = 'submit', class='submit')%]
-
-
-<a href='#' onClick='javascript:$("#filter_table input").val("");$("#filter_table input[type=checkbox]").prop("checked", 0);$("#filter_table select").prop("selectedIndex", 0);'>[% 'Reset' | $T8 %]</a>
-
+[% L.button_tag('$("#filter_form").resetForm()', LxERP.t8('Reset')) %]
 </div>
 
 </form>
index 282fd098043c43798738a5b562c913a8718fa509..fe46ff356eebf59b130e4538ae1751b2705185a1 100644 (file)
@@ -1,5 +1,5 @@
 [%- USE L %][%- USE LxERP %][%- USE HTML %]
-<form action="controller.pl" method="post">
+<form action="controller.pl" method="post" id="filter_form">
  <div class="filter_toggle">
   <a href="#" onClick="javascript:$('.filter_toggle').toggle()">[% LxERP.t8('Show Filter') %]</a>
   [% 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"))%]
 
-  <a href="#" onClick="javascript:$('#filter_table input,#filter_table select').val("");">[% LxERP.t8("Reset") %]</a>
+  [% L.button_tag('$("#filter_form").resetForm()', LxERP.t8('Reset')) %]
 
  </div>
 
index 3876cff3bb3d610ee995774db9f2d74b0a104878..bdff2082b00cc3e942d1ed0a4317cfefb436c222 100644 (file)
@@ -3,7 +3,7 @@
 [%- USE LxERP %]
 [%- USE HTML %]
 [%- SET style='width: 400px' %]
-<form action='controller.pl' method='post'>
+<form action='controller.pl' method='post' id='filter_form'>
 <div class='filter_toggle'>
 <a href='#' onClick='javascript:$(".filter_toggle").toggle()'>[% 'Show Filter' | $T8 %]</a>
   [% 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')%]
-
-
-<a href='#' onClick='javascript:$("#filter_table input").val("");$("#filter_table option").prop("selected",0)'>[% 'Reset' | $T8 %]</a>
+[% L.button_tag('$("#filter_form").resetForm()', LxERP.t8('Reset')) %]
 
 </div>
 
index d1514e0aa6982c11b74c793a9a631382ba0dd062..dafe6baa3baa5bb97cfaae8c77da47fdd3b45162 100644 (file)
@@ -12,7 +12,7 @@
 </table>
 
 [% L.button_tag('update_result()', LxERP.t8('Filter')) %]
-<a href='#' onClick='javascript:$("#multi_items_filter_table input").val("");$("#multi_items_filter_table input[type=checkbox]").prop("checked", 0);$("#multi_items_filter_table select").prop("selectedIndex", 0);'>[% 'Reset' | $T8 %]</a>
+[% L.button_tag('$("#multi_items_form").resetForm()', LxERP.t8('Reset')) %]
 
 <hr>
 <div id='multi_items_result'></div>
index 02bf33ae9f8ebb6e54dc9706506df68cab223748..f04012f3202cad610098f3095bc89af253c3f538 100644 (file)
@@ -14,7 +14,7 @@
 </table>
 
 [% L.button_tag('update_result()', LxERP.t8('Filter')) %]
-<a href='#' onClick='javascript:$("#multi_items_filter_table input").val("");$("#multi_items_filter_table input[type=checkbox]").prop("checked", 0);$("#multi_items_filter_table select").prop("selectedIndex", 0);'>[% 'Reset' | $T8 %]</a>
+[% L.button_tag('$("#multi_items_form").resetForm()', LxERP.t8('Reset')) %]
 
 <hr>
 <div id='multi_items_result'></div>
index 3bd19805207e373da1055f79167a9eef3da47d90..90a15d0fbd8fb99426555e11ca4850bf1b8eb093 100644 (file)
@@ -53,3 +53,5 @@
   </td>
  </tr>
 </table>
+
+[% L.button_tag('$("#search_form").resetForm()', LxERP.t8('Reset')) %]
index 7e6cdeea43985d3e379a08f5f8bd090d1ab049c9..ad706a46a1efc89154a25c2133c51c88d50f4d96 100644 (file)
@@ -6,7 +6,7 @@
 
 [%- INCLUDE 'common/flash.html' %]
 
- <form method="post" action="controller.pl">
+ <form method="post" action="controller.pl" id="search_form">
 
   <p>
 [%- INCLUDE 'project/_filter.html' %]
index b2ee69155bbd07d082077d66b6a66210661558a4..04346b5f0a9100863fa5459d748686590d4c8044 100644 (file)
@@ -3,7 +3,7 @@
 <h1>[%- LxERP.t8("Add link: select records to link with") %]</h1>
 
 
-<form method="post" action="controller.pl">
+<form method="post" action="controller.pl" id="record_links_add_filter_form">
  [% L.hidden_tag('object_model',   SELF.object_model) %]
  [% L.hidden_tag('object_id',      SELF.object_id) %]
 
@@ -45,7 +45,7 @@
  <p>
   [% 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) %]
-  <a href="#" onclick="record_links_reset_form();">[%- LxERP.t8("Reset") %]</a>
+  [% L.button_tag('$("#record_links_add_filter_form").resetForm()', LxERP.t8('Reset')) %]
   <a href="#" onclick="$('#record_links_add').dialog('close');">[% LxERP.t8("Cancel") %]</a>
  </p>
 
@@ -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({