|
80 | 80 | }
|
81 | 81 | });
|
82 | 82 |
|
83 |
| - $('#settings').submit(function(e) { |
| 83 | + const noChangesText = "No changes has been made"; |
| 84 | +
|
| 85 | + $('form') |
| 86 | + .each(function(){ |
| 87 | + $(this).data('serialized', $(this).serialize()) |
| 88 | + }) |
| 89 | + .on('change input', function(){ |
| 90 | + const disable = $(this).serialize() === $(this).data('serialized'); |
| 91 | + $(this) |
| 92 | + .find('input:submit, button:submit') |
| 93 | + .prop('disabled', disable) |
| 94 | + .prop('title', disable ? noChangesText : '') |
| 95 | + ; |
| 96 | + }) |
| 97 | + .find('input:submit, button:submit') |
| 98 | + .prop('disabled', true) |
| 99 | + .prop('title', noChangesText) |
| 100 | + ; |
| 101 | +
|
| 102 | + $('#settings').on('submit', function(e) { |
84 | 103 | e.preventDefault();
|
85 | 104 |
|
86 | 105 | $.ajax({
|
|
94 | 113 | duration: 3000,
|
95 | 114 | escapeMarkup: false,
|
96 | 115 | }).showToast();
|
| 116 | +
|
| 117 | + let $settings = $('#settings'); |
| 118 | + $settings.data('serialized', $settings.serialize()); |
| 119 | + $settings |
| 120 | + .find('input:submit, button:submit') |
| 121 | + .prop('disabled', true) |
| 122 | + .prop('title', noChangesText); |
97 | 123 | },
|
98 | 124 | error : function(response) {
|
99 | 125 | Toastify({
|
|
109 | 135 | });
|
110 | 136 | });
|
111 | 137 | </script>
|
| 138 | + |
112 | 139 | <script>
|
113 | 140 | {% for key, value in settings %}
|
114 | 141 | {% if value.type == 'password' %}
|
|
0 commit comments