|
4 | 4 | */
|
5 | 5 |
|
6 | 6 | (function ($) {
|
7 |
| - $(document).ready(function() { |
8 |
| - // Convert all nonalphanumeric chars to /. |
9 |
| - $('#views-exposed-form-os2web-cp-service-cp-case-search-panel-pane-1').submit(function() { |
10 |
| - // IE fix. Value and placeolder is the same on IE. |
11 |
| - if($('#edit-case-id').attr('placeholder') !== $('#edit-case-id').val()) { |
12 |
| - var value = $('#edit-case-id').val(); |
13 |
| - $('#edit-case-id').val(value.replace(/\W/g, '/')); |
14 |
| - } |
| 7 | + $(document).ready(function() { |
| 8 | + // Convert all nonalphanumeric chars to /. |
| 9 | + $('#views-exposed-form-os2web-cp-service-cp-case-search-panel-pane-1').live('submit',function(e) { |
| 10 | + // Prevent double submissions. |
| 11 | + var $form = $(this); |
15 | 12 |
|
16 |
| - // Reset dates if case id is entered. |
17 |
| - if($('#edit-case-id').val() || /^\d{2}\/\d/.test($('#edit-search-text').val())) { |
18 |
| - $('#edit-field-os2web-cp-service-date-from-value-datepicker-popup-0').val(''); |
19 |
| - $('#edit-field-os2web-cp-service-date-to-value-datepicker-popup-0').val(''); |
20 |
| - } |
21 |
| - }); |
| 13 | + if ($form.data('submitted') === true) { |
| 14 | + // Previously submitted - don't submit again |
| 15 | + e.preventDefault(); |
| 16 | + } else { |
| 17 | + // Mark it so that the next submit can be ignored |
| 18 | + $form.data('submitted', true); |
| 19 | + $form.find('button[type=submit], input[type=submit]').attr('disabled',true); |
| 20 | + } |
22 | 21 |
|
23 |
| - $( "a.qtip-this[title]" ).qtip({ |
24 |
| - style: { |
25 |
| - padding: 1, |
26 |
| - background: "#FFF", |
27 |
| - color: "black", |
28 |
| - textAlign: "center", |
29 |
| - border: { |
30 |
| - width: 1, |
31 |
| - radius: 2, |
32 |
| - color: "#DDD" |
33 |
| - }, |
34 |
| - tip: "leftMiddle" |
35 |
| - }, |
36 |
| - position: { |
37 |
| - corner: { |
38 |
| - target: "rightMiddle", |
39 |
| - tooltip: "leftMiddle" |
40 |
| - }, |
41 |
| - adjust: { |
42 |
| - x : 10 |
| 22 | + // IE fix. Value and placeolder is the same on IE. |
| 23 | + if($('#edit-case-id').attr('placeholder') !== $('#edit-case-id').val()) { |
| 24 | + var value = $('#edit-case-id').val(); |
| 25 | + $('#edit-case-id').val(value.replace(/\W/g, '/')); |
43 | 26 | }
|
| 27 | + |
| 28 | + // Reset dates if case id is entered. |
| 29 | + if($('#edit-case-id').val() || /^\d{2}\/\d/.test($('#edit-search-text').val())) { |
| 30 | + $('#edit-field-os2web-cp-service-date-from-value-datepicker-popup-0').val(''); |
| 31 | + $('#edit-field-os2web-cp-service-date-to-value-datepicker-popup-0').val(''); |
| 32 | + } |
| 33 | + }); |
| 34 | + |
| 35 | + $('#views-exposed-form-os2web-cp-service-cp-case-search-panel-pane-1 .form-submit').click(function(e){ |
| 36 | + $('.os2web_cp_service-ajax-loader').css('display', 'inline-block'); |
| 37 | + }); |
| 38 | + |
| 39 | + $('.views-field-field-os2web-cp-service-file-id a').click(function(e){ |
| 40 | + // Find the ajax loader in next td in table. |
| 41 | + $(this).parent().parent().find('.os2web_cp_service-ajax-loader').css('display', 'inline-block'); |
| 42 | + }); |
| 43 | + |
| 44 | + if(typeof $( "a.qtip-this[title]" ).qtip === 'function') { |
| 45 | + $("a.qtip-this[title]").qtip({ |
| 46 | + style: { |
| 47 | + padding: 1, |
| 48 | + background: "#FFF", |
| 49 | + color: "black", |
| 50 | + textAlign: "center", |
| 51 | + border: { |
| 52 | + width: 1, |
| 53 | + radius: 2, |
| 54 | + color: "#DDD" |
| 55 | + }, |
| 56 | + tip: "leftMiddle" |
| 57 | + }, |
| 58 | + position: { |
| 59 | + corner: { |
| 60 | + target: "rightMiddle", |
| 61 | + tooltip: "leftMiddle" |
| 62 | + }, |
| 63 | + adjust: { |
| 64 | + x : 10 |
| 65 | + } |
| 66 | + } |
| 67 | + }); |
44 | 68 | }
|
45 | 69 | });
|
46 |
| - }); |
47 | 70 | })(jQuery);
|
0 commit comments