diff --git a/Altob.NtuInvoiceGateway/Pages/Invoice.cshtml b/Altob.NtuInvoiceGateway/Pages/Invoice.cshtml index c6a3a17..46be77f 100644 --- a/Altob.NtuInvoiceGateway/Pages/Invoice.cshtml +++ b/Altob.NtuInvoiceGateway/Pages/Invoice.cshtml @@ -58,12 +58,12 @@
- 注意:以下四個選項至少需填寫一個 + 注意:以下四個選項僅能擇一填寫
- +
diff --git a/Altob.NtuInvoiceGateway/Pages/Invoice.cshtml.cs b/Altob.NtuInvoiceGateway/Pages/Invoice.cshtml.cs index 0fddc12..7975d0c 100644 --- a/Altob.NtuInvoiceGateway/Pages/Invoice.cshtml.cs +++ b/Altob.NtuInvoiceGateway/Pages/Invoice.cshtml.cs @@ -216,7 +216,7 @@ public class InvoiceModel : PageModel return Page(); } - // 驗證 Email, CarrierID, BuyerIdentifier 至少填寫一個 + // 驗證 Email, CarrierID, BuyerIdentifier, LoveCode 僅能擇一填寫 int filledCount = 0; if (!string.IsNullOrEmpty(InvoiceData.Email)) filledCount++; if (!string.IsNullOrEmpty(InvoiceData.CarrierID)) filledCount++; @@ -225,7 +225,13 @@ public class InvoiceModel : PageModel if (filledCount == 0) { - ErrorMessage = "Email、手機條碼、購買者統編至少需填寫一個"; + ErrorMessage = "Email、手機條碼、購買者統編、捐贈碼僅能擇一填寫,請填寫任一項"; + return Page(); + } + + if (filledCount > 1) + { + ErrorMessage = "Email、手機條碼、購買者統編、捐贈碼僅能擇一填寫,請刪除多餘輸入"; return Page(); }