Fix visual bug when user clicks on "Create refund" without selecting an option (#3624)

* Add missing refund option validation error element

* Add missing hidden inputs for text elements

* Move validation element above button

* Update validation error message
This commit is contained in:
Umar Bolatov 2022-04-11 01:53:52 -07:00 committed by GitHub
parent c9f0988b95
commit fe6b7dc1e3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 1 deletions

View file

@ -311,7 +311,7 @@ namespace BTCPayServer.Controllers
model.RefundStep = RefundSteps.SelectCustomAmount;
return View(model);
default:
ModelState.AddModelError(nameof(model.SelectedRefundOption), "Invalid choice");
ModelState.AddModelError(nameof(model.SelectedRefundOption), "Please select an option before proceeding");
return View(model);
}

View file

@ -13,6 +13,10 @@
<form method="post">
<input type="hidden" asp-for="RefundStep" value="@Model.RefundStep"/>
<input type="hidden" asp-for="Title" value="@Model.Title"/>
<input type="hidden" asp-for="RateThenText" value="@Model.RateThenText"/>
<input type="hidden" asp-for="CurrentRateText" value="@Model.CurrentRateText"/>
<input type="hidden" asp-for="FiatText" value="@Model.FiatText"/>
@switch (Model.RefundStep)
{
case RefundSteps.SelectPaymentMethod:
@ -59,6 +63,9 @@
</div>
<small class="form-text text-muted">The specified amount with the specified currency, at the rate when the refund will be sent. </small>
</div>
<div class="form-group">
<span asp-validation-for="SelectedRefundOption" class="text-danger w-100"></span>
</div>
<div class="form-group">
<button id="ok" type="submit" class="btn btn-primary btn-lg w-100">Create refund</button>
</div>