From a20906bc125c4b0a65bad3990090369a4f9855b0 Mon Sep 17 00:00:00 2001 From: "nicolas.dorier" Date: Thu, 12 Aug 2021 10:04:23 +0900 Subject: [PATCH] Fix paybutton like when no amount set --- BTCPayServer/wwwroot/paybutton/paybutton.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/BTCPayServer/wwwroot/paybutton/paybutton.js b/BTCPayServer/wwwroot/paybutton/paybutton.js index ffab19815..f1ee81a85 100644 --- a/BTCPayServer/wwwroot/paybutton/paybutton.js +++ b/BTCPayServer/wwwroot/paybutton/paybutton.js @@ -148,7 +148,7 @@ function inputChanges(event, buttonSize) { // Fixed amount: Add price and currency as hidden inputs if (isFixedAmount) { - if (srvModel.price !== '') + if (srvModel.price) html += addInput(priceInputName, srvModel.price); if(allowCurrencySelection){ html += addInput("currency", srvModel.currency); @@ -158,7 +158,8 @@ function inputChanges(event, buttonSize) { else if (isCustomAmount) { html += '
\n
\n'; html += srvModel.simpleInput ? '' : addPlusMinusButton("-", srvModel.step, srvModel.min, srvModel.max); - html += ' ' + addInputPrice(priceInputName, srvModel.price, widthInput, "", "number", srvModel.min, srvModel.max, srvModel.step); + if (srvModel.price) + html += ' ' + addInputPrice(priceInputName, srvModel.price, widthInput, "", "number", srvModel.min, srvModel.max, srvModel.step); html += srvModel.simpleInput ? '' : addPlusMinusButton("+", srvModel.step, srvModel.min, srvModel.max); html += '
\n'; if(allowCurrencySelection) { @@ -198,7 +199,7 @@ function inputChanges(event, buttonSize) { var url = new URL(form.getAttribute("action")); var formData = new FormData(form); formData.forEach((value, key) => { - if(key !== "jsonResponse"){ + if (key !== "jsonResponse") { url.searchParams.append(key, value); } });