I have just started receiving an error in code that has been working for weeks, after updating from Radzen 4.23.2 to 4.30.2 (still working) to 4.31.0.
The following code checks the Birthdate value against an _oldest and _youngest value, letting the user know if the customer is too young or too old:
<div class="row">
<div class="col-md-4 align-items-center d-flex">
<RadzenLabel Text="Date of Birth"/>
</div>
<div class="col-md-8">
<RadzenDatePicker style="width: 100%;" @bind-Value="@Birthdate" Name="birthDate" DateFormat="MM/dd/yyyy"/>
<RadzenRequiredValidator Popup="true" Style="position: absolute" Component="birthDate" Text="Birthdate is required!"/>
<RadzenCompareValidator Visible="@(Birthdate < _oldest)" Value="@Birthdate" Component="birthDate" Text="Student must be 110 or younger!" Style="position: absolute"/>
<RadzenCompareValidator Visible="@(Birthdate > _youngest)" Value="@Birthdate" Component="birthDate" Text="Student must be 12 or older" Style="position: absolute"/>
</div>
</div>
The first error to throw is this one:
The error occurs when leaving the DropDown.
The code that sets the values above is here:
private StudentVm Student { get; } = new();
private DateTime Birthdate { get; set; } = DateTime.Today;
private DateTime _youngest;
private DateTime _oldest;
protected override void OnInitialized()
{
Student.LastModifiedDate = DateTime.Today;
Student.ClassId = ClassId;
Student.UserId = "";
Student.BirthDate = DateTime.Now.AddYears(-12);
_youngest = Student.BirthDate;
_oldest = DateTime.Now.AddYears(-110);
}
If I comment out the two RadzenCompareValidator lines, leaving just the RadzenDropDown and the RadzenRequiredValidator, the code works.
Anyone have any thoughts on this?
After some testing, I can say that it works properly in 4.23.2 and 4.30.2, it breaks in 4.30.3, and it remains broken in 4.31.0.
Thanks,
William