Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 405313d5

Von Moritz Bunkus vor fast 8 Jahren hinzugefügt

  • ID 405313d551dc6e398887716a2889f19d51f0375b
  • Vorgänger 59adfa36
  • Nachfolger 28633ebf

jQuery-resetForm() anstelle von selbst geschriebenem Reset-Code nutzen

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.

Unterschiede anzeigen:

templates/webpages/background_job_history/_filter.html
1 1
[%- USE L %][%- USE LxERP %][%- USE HTML %]
2
<form action="controller.pl" method="post">
2
<form action="controller.pl" method="post" id="filter_form">
3 3
 <div class="filter_toggle">
4 4
  <a href="#" onClick="javascript:$('.filter_toggle').toggle()">[% LxERP.t8('Show Filter') %]</a>
5 5
  [% IF SELF.filter_summary %]([% LxERP.t8("Current filter") %]: [% SELF.filter_summary %])[% END %]
......
40 40
  [% L.hidden_tag('page', FORM.page) %]
41 41
  [% L.submit_tag('action_list', LxERP.t8('Continue'))%]
42 42

  
43
  <a href="#" onClick="javascript:$('#filter_table input,#filter_table select').val('');">[% LxERP.t8('Reset') %]</a>
43
  [% L.button_tag("\$('#filter_form').resetForm();", LxERP.t8('Reset')) %]
44 44

  
45 45
 </div>
46 46

  
templates/webpages/bank_transactions/_filter.html
2 2
[%- USE L %]
3 3
[%- USE LxERP %]
4 4
[%- USE HTML %]
5
<form action='controller.pl' method='post'>
5
<form action='controller.pl' method='post' id='filter_form'>
6 6
<div class='filter_toggle'>
7 7
<a href='#' onClick='javascript:$(".filter_toggle").toggle()'>[% 'Show Filter' | $T8 %]</a>
8 8
  [% SELF.filter_summary | html %]
......
68 68
[% L.input_tag('action_list_all', LxERP.t8('Continue'), type = 'submit', class='submit')%]
69 69

  
70 70

  
71
<a href='#' onClick='javascript:$("#filter_table input").val("");$("#filter_table input[type=checkbox]").prop("checked", 0);'>[% 'Reset' | $T8 %]</a>
72

  
71
[% L.button_tag('$("#filter_form").resetForm()', LxERP.t8('Reset')) %]
73 72
</div>
74 73

  
75 74
</form>
templates/webpages/bank_transactions/assign_invoice.html
2 2

  
3 3
[% SET debug = 0 %]
4 4

  
5
<form method="post" action="javascript:filter_invoices();">
5
<form method="post" action="javascript:filter_invoices();" id="assign_invoice_window_form">
6 6
  <b>[%- LxERP.t8("Bank transaction") %]:</b>
7 7
  <table>
8 8
   <tr class="listheading">
......
56 56
  <p>
57 57
   [% L.submit_tag('', LxERP.t8("Search")) %]
58 58
   [% L.button_tag('add_selected_invoices()', LxERP.t8("Add invoices"), id='add_selected_record_links_button') %]
59
   <a href="#" onclick="assign_invoice_reset_form();">[%- LxERP.t8("Reset") %]</a>
59
   [% L.button_tag('$("#assign_invoice_window_form").resetForm()', LxERP.t8('Reset')) %]
60 60
   <a href="#" onclick="$('#assign_invoice_window').dialog('close');">[% LxERP.t8("Cancel") %]</a>
61 61
  </p>
62 62

  
......
95 95
  });
96 96
}
97 97

  
98
function assign_invoice_reset_form() {
99
  $('#assign_invoice_window form input[type=text]').val('');
100
}
101

  
102 98
$(function() {
103 99
  $('#invnumber').focus();
104 100
});
105 101

  
106 102
//-->
107 103
</script>
108

  
templates/webpages/delivery_plan/_filter.html
102 102
[% L.hidden_tag('mode', SELF.mode) %]
103 103
[% L.input_tag('action_list', LxERP.t8('Continue'), type = 'submit', class='submit')%]
104 104

  
105

  
106
<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>
107

  
105
[% L.button_tag('$("#filter_form").resetForm()', LxERP.t8('Reset')) %]
108 106
</div>
109 107

  
110 108
</form>
templates/webpages/delivery_value_report/_filter.html
2 2
[%- USE L %]
3 3
[%- USE LxERP %]
4 4
[%- USE HTML %]
5
<form action='controller.pl' method='post'>
5
<form action='controller.pl' method='post' id='filter_form'>
6 6
<div class='filter_toggle'>
7 7
<a href='#' onClick='javascript:$(".filter_toggle").toggle()'>[% 'Show Filter' | $T8 %]</a>
8 8
  [% SELF.filter_summary | html %]
......
94 94
[% L.hidden_tag('page', FORM.page) %]
95 95
[% L.hidden_tag('vc', SELF.vc) %]
96 96
[% L.input_tag('action_list', LxERP.t8('Continue'), type = 'submit', class='submit')%]
97

  
98

  
99
<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>
100

  
97
[% L.button_tag('$("#filter_form").resetForm()', LxERP.t8('Reset')) %]
101 98
</div>
102 99

  
103 100
</form>
templates/webpages/email_journal/_filter.html
1 1
[%- USE L %][%- USE LxERP %][%- USE HTML %]
2
<form action="controller.pl" method="post">
2
<form action="controller.pl" method="post" id="filter_form">
3 3
 <div class="filter_toggle">
4 4
  <a href="#" onClick="javascript:$('.filter_toggle').toggle()">[% LxERP.t8('Show Filter') %]</a>
5 5
  [% IF SELF.filter_summary %]([% LxERP.t8("Current filter") %]: [% SELF.filter_summary %])[% END %]
......
36 36
  [% L.hidden_tag("page", FORM.page) %]
37 37
  [% L.submit_tag("action_list", LxERP.t8("Continue"))%]
38 38

  
39
  <a href="#" onClick="javascript:$('#filter_table input,#filter_table select').val("");">[% LxERP.t8("Reset") %]</a>
39
  [% L.button_tag('$("#filter_form").resetForm()', LxERP.t8('Reset')) %]
40 40

  
41 41
 </div>
42 42

  
templates/webpages/financial_controlling_report/_filter.html
3 3
[%- USE LxERP %]
4 4
[%- USE HTML %]
5 5
[%- SET style='width: 400px' %]
6
<form action='controller.pl' method='post'>
6
<form action='controller.pl' method='post' id='filter_form'>
7 7
<div class='filter_toggle'>
8 8
<a href='#' onClick='javascript:$(".filter_toggle").toggle()'>[% 'Show Filter' | $T8 %]</a>
9 9
  [% SELF.filter_summary %]
......
50 50
[% L.hidden_tag('sort_dir', FORM.sort_dir) %]
51 51
[% L.hidden_tag('page', FORM.page) %]
52 52
[% L.input_tag('action_list', LxERP.t8('Continue'), type = 'submit', class='submit')%]
53

  
54

  
55
<a href='#' onClick='javascript:$("#filter_table input").val("");$("#filter_table option").prop("selected",0)'>[% 'Reset' | $T8 %]</a>
53
[% L.button_tag('$("#filter_form").resetForm()', LxERP.t8('Reset')) %]
56 54

  
57 55
</div>
58 56

  
templates/webpages/order/tabs/_multi_items_dialog.html
12 12
</table>
13 13

  
14 14
[% L.button_tag('update_result()', LxERP.t8('Filter')) %]
15
<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>
15
[% L.button_tag('$("#multi_items_form").resetForm()', LxERP.t8('Reset')) %]
16 16

  
17 17
<hr>
18 18
<div id='multi_items_result'></div>
templates/webpages/part/_multi_items_dialog.html
14 14
</table>
15 15

  
16 16
[% L.button_tag('update_result()', LxERP.t8('Filter')) %]
17
<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>
17
[% L.button_tag('$("#multi_items_form").resetForm()', LxERP.t8('Reset')) %]
18 18

  
19 19
<hr>
20 20
<div id='multi_items_result'></div>
templates/webpages/project/_filter.html
53 53
  </td>
54 54
 </tr>
55 55
</table>
56

  
57
[% L.button_tag('$("#search_form").resetForm()', LxERP.t8('Reset')) %]
templates/webpages/project/search.html
6 6

  
7 7
[%- INCLUDE 'common/flash.html' %]
8 8

  
9
 <form method="post" action="controller.pl">
9
 <form method="post" action="controller.pl" id="search_form">
10 10

  
11 11
  <p>
12 12
[%- INCLUDE 'project/_filter.html' %]
templates/webpages/record_links/add_filter.html
3 3
<h1>[%- LxERP.t8("Add link: select records to link with") %]</h1>
4 4

  
5 5

  
6
<form method="post" action="controller.pl">
6
<form method="post" action="controller.pl" id="record_links_add_filter_form">
7 7
 [% L.hidden_tag('object_model',   SELF.object_model) %]
8 8
 [% L.hidden_tag('object_id',      SELF.object_id) %]
9 9

  
......
45 45
 <p>
46 46
  [% L.button_tag('filter_record_links()', LxERP.t8("Search")) %]
47 47
  [% L.button_tag('add_selected_record_links()', LxERP.t8("Add links"), id='add_selected_record_links_button', disabled=1) %]
48
  <a href="#" onclick="record_links_reset_form();">[%- LxERP.t8("Reset") %]</a>
48
  [% L.button_tag('$("#record_links_add_filter_form").resetForm()', LxERP.t8('Reset')) %]
49 49
  <a href="#" onclick="$('#record_links_add').dialog('close');">[% LxERP.t8("Cancel") %]</a>
50 50
 </p>
51 51

  
......
63 63
  record_links_change_form_to_match_type();
64 64
});
65 65

  
66
function record_links_reset_form() {
67
  $('#record_links_add form input[type=text]').val('');
68
  $('#record_links_add form select').prop('selectedIndex', 0);
69
}
70

  
71 66
function filter_record_links() {
72 67
  var url="controller.pl?action=RecordLinks/ajax_add_list&" + $("#record_links_add form").serialize();
73 68
  $.ajax({

Auch abrufbar als: Unified diff