Skip to content

Commit

Permalink
ActionPage validation
Browse files Browse the repository at this point in the history
  • Loading branch information
michielpost committed Apr 24, 2024
1 parent 1eb0800 commit 4a658ee
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/aoWebWallet/Pages/ActionPage.razor
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
}
else
{
<MudSelect @bind-Value="@selectedWallet" Label="Select a wallet" Variant="Variant.Outlined" MaxHeight="250">
<MudSelect @bind-Value="@selectedWallet" Label="Select a wallet" Variant="Variant.Outlined" MaxHeight="250" ReadOnly="@readOnly">
@foreach (var wallet in BindingContext.WalletList.Data ?? new())
{
<MudSelectItem Value="@wallet.Address">
Expand Down
17 changes: 14 additions & 3 deletions src/aoWebWallet/Shared/Components/ActionInputComponent.razor
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,20 @@ else
protected override void OnAfterRender(bool firstRender)
{
mudTextField?.SetText(ActionParam.Value);
mudProcessField?.SetText(ActionParam.Value);
mudIntField?.SetText(ActionParam.Value);
if (!(mudTextField?.ValidationErrors.Any() ?? false))
{
mudTextField?.SetText(ActionParam.Value);
}

if (!(mudProcessField?.ValidationErrors.Any() ?? false))
{
mudProcessField?.SetText(ActionParam.Value);
}

if (!(mudIntField?.ValidationErrors.Any() ?? false))
{
mudIntField?.SetText(ActionParam.Value);
}

base.OnAfterRender(firstRender);
}
Expand Down
13 changes: 8 additions & 5 deletions src/aoWebWallet/Shared/Components/ActionQuantityComponent.razor
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,10 @@ else

protected override void OnAfterRender(bool firstRender)
{
mudTextField?.SetText(ActionParam.Value);
if (!(mudTextField?.ValidationErrors.Any() ?? false))
{
mudTextField?.SetText(ActionParam.Value);
}

base.OnAfterRender(firstRender);
}
Expand All @@ -84,10 +87,10 @@ else

public IEnumerable<string> ValidateBalance(decimal e)
{
// if (e == null)
// {
// yield return "Please enter a value.";
// }
if (e < 0)
{
yield return "Must be greater or equal than 0.";
}

if(e > 0)
{
Expand Down

0 comments on commit 4a658ee

Please sign in to comment.