RadzenNumeric defaults to min value

I am using Radzen Numeric with a nullable decimal. The default should be null. Worked well until I installed 4.12.1. When I now tab out, the value changes to the minimum rather than staying on the default. The change event is not firing, it just displaying the min value after you tab out.

<RadzenNumeric TValue="decimal?"  ShowUpDown="false" TextAlign="TextAlign.Center" Min="10"  Max="50" @bind-Value="@myValue" />     

I can also reproduce the issue in the Radzen demos with the following:

<div class="rz-p-12 rz-text-align-center">
    <RadzenNumeric ShowUpDown="false" TValue="int?" Min=1 Max=100  @bind-Value=@value Placeholder="Enter or clear value" />
</div>

@code{
    int? value;
}

It appears to be a potential bug.

Hi @mrentier,

This is definitely a bug and will be fixed immediately!

1 Like

4.15.2 and higher seem to have a regression on this. Following is based upon the Radzen demo and reproduces it:

<div class="rz-p-12 rz-text-align-center">
    <div>@value</div>
    <RadzenNumeric Min="1" Max="10" TValue="int?" @bind-Value=@value Change=@(_=>StateHasChanged()) />
</div>

@code{
    int? value;
}

@enchev : did this bug show up again?

It seems that the issue was not fixed completely with my previous commit - it will be fixed in our update later today.

1 Like

@enchev starting with 4.23.7 this issue showed up again. I have verified that 4.23.6 functions correctly.

Most probably caused by this:

I will check it and we will release update Monday.

I just tested your code in our latest demos however I was unable to reproduce it:


tried both nullable int and decimal:

numeric-format

<div class="rz-p-12 rz-text-align-center">
    <RadzenNumeric Min="1" Max="10" TValue="int?" @bind-Value=@value  />
</div>

@code{
    int? value;
}

Enter a value, for example 5 and tab out. Then clear the box and tab out. A value of 1 is displayed. You should be able to clear an input box with a nullable value even when min/max have been set for when a value is provided. If you want to require a value, then you can use a non-nullable type.

There is a test now to make sure that it will not happen again:

1 Like