From d12ec5f88537e8e8724208eddc6929df59cb3a3f Mon Sep 17 00:00:00 2001 From: RD WebDesign Date: Tue, 17 May 2022 15:54:01 -0300 Subject: [PATCH] Clean text fields after success. Signed-off-by: RD WebDesign --- scripts/pi-hole/js/customcname.js | 8 ++++++++ scripts/pi-hole/js/customdns.js | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/scripts/pi-hole/js/customcname.js b/scripts/pi-hole/js/customcname.js index 09556695..e78e4a7e 100644 --- a/scripts/pi-hole/js/customcname.js +++ b/scripts/pi-hole/js/customcname.js @@ -87,6 +87,10 @@ function addCustomCNAME() { "Custom CNAME added", domain + ": " + target ); + + // Clean up field values and reload table data + $("#domain").val(""); + $("#target").val(""); table.ajax.reload(); } else { utils.showAlert("error", "fas fa-times", "Failure! Something went wrong", response.message); @@ -120,6 +124,10 @@ function deleteCustomCNAME() { "Custom CNAME deleted", domain + ": " + target ); + + // Clean up field values and reload table data + $("#domain").val(""); + $("#target").val(""); table.ajax.reload(); } else { utils.showAlert("error", "fas fa-times", "Failure! Something went wrong", response.message); diff --git a/scripts/pi-hole/js/customdns.js b/scripts/pi-hole/js/customdns.js index 5043520b..865f54b0 100644 --- a/scripts/pi-hole/js/customdns.js +++ b/scripts/pi-hole/js/customdns.js @@ -81,6 +81,10 @@ function addCustomDNS() { utils.enableAll(); if (response.success) { utils.showAlert("success", "far fa-check-circle", "Custom DNS added", domain + ": " + ip); + + // Clean up field values and reload table data + $("#domain").val(""); + $("#id").val(""); table.ajax.reload(); } else { utils.showAlert("error", "fas fa-times", "Failure! Something went wrong", response.message); @@ -109,6 +113,10 @@ function deleteCustomDNS() { utils.enableAll(); if (response.success) { utils.showAlert("success", "far fa-check-circle", "Custom DNS deleted", domain + ": " + ip); + + // Clean up field values and reload table data + $("#domain").val(""); + $("#id").val(""); table.ajax.reload(); } else { utils.showAlert("error", "fas fa-times", "Failure! Something went wrong", response.message);