From eeb07535ad568b4bab2c344a770de5fbf3ff0836 Mon Sep 17 00:00:00 2001 From: RD WebDesign Date: Tue, 14 Nov 2023 19:58:41 -0300 Subject: [PATCH 1/2] Clear input fields after successfully adding new items Applies to Clients, Domains and Lists. --- scripts/pi-hole/js/groups-clients.js | 1 + scripts/pi-hole/js/groups-domains.js | 4 ++++ scripts/pi-hole/js/groups-lists.js | 2 ++ 3 files changed, 7 insertions(+) diff --git a/scripts/pi-hole/js/groups-clients.js b/scripts/pi-hole/js/groups-clients.js index a0d8faea..ea27f602 100644 --- a/scripts/pi-hole/js/groups-clients.js +++ b/scripts/pi-hole/js/groups-clients.js @@ -459,6 +459,7 @@ function addClient() { utils.enableAll(); utils.listsAlert("client", ips, data); reloadClientSuggestions(); + $("#new_comment").val(""); table.ajax.reload(null, false); table.rows().deselect(); diff --git a/scripts/pi-hole/js/groups-domains.js b/scripts/pi-hole/js/groups-domains.js index c430e560..6e62f7d2 100644 --- a/scripts/pi-hole/js/groups-domains.js +++ b/scripts/pi-hole/js/groups-domains.js @@ -553,6 +553,10 @@ function addDomain() { success: function (data) { utils.enableAll(); utils.listsAlert("domain", domains, data); + $("#new_domain").val(""); + $("#new_domain_comment").val(""); + $("#new_regex").val(""); + $("#new_regex_comment").val(""); table.ajax.reload(null, false); table.rows().deselect(); diff --git a/scripts/pi-hole/js/groups-lists.js b/scripts/pi-hole/js/groups-lists.js index cf859a9c..c0768501 100644 --- a/scripts/pi-hole/js/groups-lists.js +++ b/scripts/pi-hole/js/groups-lists.js @@ -529,6 +529,8 @@ function addList(event) { success: function (data) { utils.enableAll(); utils.listsAlert("list", addresses, data); + $("#new_address").val(""); + $("#new_comment").val(""); table.ajax.reload(null, false); table.rows().deselect(); From 74fa7e49656b680526bcb5b000b05ca89c3fa63c Mon Sep 17 00:00:00 2001 From: RD WebDesign Date: Wed, 15 Nov 2023 16:52:00 -0300 Subject: [PATCH 2/2] Also clear input fields after adding DNS and CNAME records. Signed-off-by: RD WebDesign --- scripts/pi-hole/js/settings-dns-records.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/pi-hole/js/settings-dns-records.js b/scripts/pi-hole/js/settings-dns-records.js index d48df91a..cf288b5d 100644 --- a/scripts/pi-hole/js/settings-dns-records.js +++ b/scripts/pi-hole/js/settings-dns-records.js @@ -225,6 +225,8 @@ $(document).ready(function () { .done(function () { utils.enableAll(); utils.showAlert("success", "fas fa-plus", "Successfully added DNS record", elem); + $("#Hdomain").val(""); + $("#Hip").val(""); $("#hosts-Table").DataTable().ajax.reload(null, false); }) .fail(function (data, exception) { @@ -249,6 +251,8 @@ $(document).ready(function () { .done(function () { utils.enableAll(); utils.showAlert("success", "fas fa-plus", "Successfully added CNAME record", elem); + $("#Cdomain").val(""); + $("#Ctarget").val(""); $("#cnameRecords-Table").DataTable().ajax.reload(null, false); }) .fail(function (data, exception) {