Hi,
I have a dialog and on this dialog, I have a text area.
@page "/refundreason/{paymentIntentId}"
@using Radzen
@using System.ComponentModel.DataAnnotations
@inject DialogService DialogService
<RadzenStack Orientation="Orientation.Horizontal" Gap="0.5rem" AlignItems="AlignItems.Center" JustifyContent="JustifyContent.SpaceBetween">
<RadzenStack Orientation="Orientation.Horizontal">
<Content>
<h2>Refund Reason</h2>
<RadzenTextArea @oninput="@(args => OnChange(args.Value.ToString()))" class="form-control" aria-label="TextArea" @bind-Value="RefundReason" />
<RadzenButton class="btn btn-primary mt-2" Click="@((args) => DialogService.Close(RefundReason))"
Disabled="@IsDisabled">Submit</RadzenButton>
<RadzenButton class="btn btn-secondary mt-2" Click="@((args) => DialogService.Close(false))">Close</RadzenButton>
</Content>
</RadzenStack>
</RadzenStack>
@code {
[Parameter]
public string paymentIntentId { get; set; }
public bool ShowDialog { get; set; } = false;
public string RefundReason { get; set; } = "";
public bool IsDisabled { get; set; } = true;
void OnChange(string value)
{
//Check if the refund reason is not empty then enable the submit button
IsDisabled = string.IsNullOrEmpty(RefundReason);
}
}
I would like to enable Submit button if there is an entry to the text area. Unfortunately, my code is not working the way I want to. Any help would be great.
Thank you.