I try to capture text changes of InputText in Blazor (ServerSide) and then call a async method to check if input is correct coupon code or not.
HTML:
<EditForm Model="@Basket" OnValidSubmit="@CommitBasket">
Gutscheincode
<InputText class="coupon-input checkout-control pristine untouched"
@bind-Value="CouponCode"
@onchange="CouponCodeChanged">
</InputText>
@CouponText
</EditForm>`
But The CouponCodeChanged isn't raised - OnKeyUp is not useful because the Text Value isn't changed at that state...
here is C# Method:
public async Task CouponCodeChanged(ChangeEventArgs args)
{
using var client = ClientFactory.CreateClient();
var result = await ApiCalls.GetCouponCodeData(client, AppState.BaseUrl, 2, CouponCode);
CouponText = result== null ? "NOT FOUND" : $"exists:{result.Exists} amount:{result.Amount}";
}
Has anyone a hint or idea how to solve that in a convinient way?
Thx!