From 4601388f3faefa41e826e52091c60db3426a0e4d Mon Sep 17 00:00:00 2001 From: ljm42 Date: Wed, 25 Oct 2023 17:11:50 -0700 Subject: [PATCH] Fix Remote Access Apply button --- .../plugins/dynamix.my.servers/Connect.page | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/plugin/source/dynamix.unraid.net/usr/local/emhttp/plugins/dynamix.my.servers/Connect.page b/plugin/source/dynamix.unraid.net/usr/local/emhttp/plugins/dynamix.my.servers/Connect.page index 42c301c35..3198ba753 100644 --- a/plugin/source/dynamix.unraid.net/usr/local/emhttp/plugins/dynamix.my.servers/Connect.page +++ b/plugin/source/dynamix.unraid.net/usr/local/emhttp/plugins/dynamix.my.servers/Connect.page @@ -240,10 +240,10 @@ function changeRemoteAccess(dropdown) { // don't let the user edit the UPnP port $("#wanport").hide(); // show the UPnP port read-only if neither port nor dropdown has changed since page loaded - if ($("#remoteAccess").val() == $("#remoteAccess").data('orig') && $("#wanport").val() == $("#wanport").data('orig')) { - $("#wanportdisplay").show(); - } else { + if (didRemoteAccessFormChange()) { $("#wanportdisplay").hide(); + } else { + $("#wanportdisplay").show(); } } else { // let the user edit the port @@ -292,11 +292,21 @@ function changeRemoteAccess(dropdown) { $('#remoteAccessMsg').html($remoteAccessMsgTxt); $('#useConnectMsg').html($useConnectMsgTxt); + enableDisableApplyButton(); +} + +function didRemoteAccessFormChange() { + $changed = !($("#remoteAccess").val() == $("#remoteAccess").data('orig') && $("#wanport").val() == $("#wanport").data('orig')); + return $changed; +} + +function enableDisableApplyButton() { + $('body').find('.applyBtn').prop("disabled", !didRemoteAccessFormChange()); } function enableDisableCheckButton() { - $enabled = ($("#remoteAccess").val() == $("#remoteAccess").data('orig') && $("#wanport").val() == $("#wanport").data('orig')); - $("#wancheck").prop("disabled", !$enabled); + $("#wancheck").prop("disabled", didRemoteAccessFormChange()); + enableDisableApplyButton(); } function checkFlashBackup() {