Hello on top of my Editform in Blazor I get the error Message. It seems to have only the default of FluentValidationValidator default class. Here is the code:
@using abcde.lib.DTOs.WorkItemDTOs.TimeBlockPropertiesDTOs@using abcdeWASM2.ViewModels.Home@using abcde.lib.DTOs.WorkItemDTOs;@inherits BaseAuthorisedComponent@if (IsOpen){<ModalDialog CloseDialog="CloseDialog" MiniDialog="true"><DialogHeader><BoardDotComponent BoardColour="brand-orange" Size="2"></BoardDotComponent><h3 class="text-xl flex items-center">@baseLocale["DialogTimeBlock_TimeBlock"].Value</h3></DialogHeader><DialogBody><EditForm EditContext="@editContext" OnValidSubmit="UpdateTimeBlock"><FluentValidationValidator /><ValidationSummary /><div class="p-6"><div class="relative my-5"><DatePickerInput Id="startDate" Placeholder="@baseLocale["DialogTimeBlock_Startdate"].Value" SelectedDate="model.StartDate" SelectedDateChanged="OnStartDateChange" ValidationFor="() => default"></DatePickerInput></div><div class="relative my-5"><DatePickerInput Id="startDate" Placeholder="@baseLocale["DialogTimeBlock_Enddate"].Value" SelectedDate="model.EndDate" SelectedDateChanged="OnEndDateChange" ValidationFor="() => default" Required="@EndDateRequired"></DatePickerInput></div> <div class="relative my-5"><TimePickerInput Id="startDate" Placeholder="@baseLocale["DialogTimeBlock_Starttime"].Value" SelectedTime="model.From" SelectedTimeChanged="OnStartTimeChange" ValidationFor="() => default"></TimePickerInput></div> <div class="relative my-5"><TimePickerInput Id="startDate" Placeholder="@baseLocale["DialogTimeBlock_Endtime"].Value" SelectedTime="model.To" SelectedTimeChanged="OnEndTimeChange" ValidationFor="() => default"></TimePickerInput></div> <div class="relative my-5"><div class="w-full"><select id="recurrance-pattern" name="recurrance-pattern" class="border px-3 py-2 rounded-md w-full" @bind="model.TimeBlockPattern" @bind:after="ChangeSelection"> @foreach (TimeBlockPattern item in Enum.GetValues(typeof(TimeBlockPattern))) {<option value="@item">@($"{baseLocale[$"{item.ToString()}"].Value}") </option> }</select></div> @* <StandardSingleSelect Id="recurrance-pattern" Label="" Initial="@baseLocale["DialogTimeBlock_Recurrancepattern"].Value" SelectedValue="@SelectedOccurance" Options="@(new string[] { "Onetime", "Daily", "Weekly", "Monthly", "Yearly" })" SelectedValueChanged="OnOccuranceChange" /> *@</div> @if (model.TimeBlockPattern == TimeBlockPattern.Daily && model.DailyProperties is not null) {<div class="relative my-5"><InputNumber class="peer w-full border border-gray-300 focus:border-brand-blue rounded-xl p-3 placeholder:text-transparent" @bind-Value="model.DailyProperties.Interval" /></div> } @if (model.TimeBlockPattern == TimeBlockPattern.Monthly && model.MonthlyProperties is not null) {<div class="relative my-5"><InputNumber class="peer w-full border border-gray-300 focus:border-brand-blue rounded-xl p-3 placeholder:text-transparent" @bind-Value="model.MonthlyProperties.Interval" /></div> } @if (model.TimeBlockPattern == TimeBlockPattern.Yearly && model.YearlyProperties is not null) {<div class="relative my-5"><InputNumber class="peer w-full border border-gray-300 focus:border-brand-blue rounded-xl p-3 placeholder:text-transparent" @bind-Value="model.YearlyProperties.Interval" /></div> } @if (model.TimeBlockPattern == TimeBlockPattern.Weekly && model.WeeklyProperties is not null) {<div class="relative d-flex gap-3 flex-wrap my-5"> @foreach (DaysOfWeekEnum day in Enum.GetValues(typeof(DaysOfWeekEnum))) {<button type="button" @onclick="@(()=>OnSelectWeek(day))"><p style="background-color: #4F28FE;color: #fff;border-radius: 8px;padding: 6px 10px;font-size: 12px;text-transform: uppercase;margin: 5px;">@day.ToString()</p></button> }</div> }</div><div class="border-gray-200 flex gap-2 p-6"><CancelButtonComponent ClickHandler="CloseDialog" /><SaveButtonComponent Label="@baseLocale["Save"].Value" ClickHandler="UpdateTimeBlock" /></div></EditForm></DialogBody></ModalDialog>}@code { [Parameter] public Action handleHideClick { get; set; } = () =>{}; [Parameter] public bool IsOpen { get; set; } = false; [Parameter] public EventCallback<TimeBlockToUpdateDTO> OnSaveTimeBlock { get; set; } private EditContext editContext = default!; private TimeBlockToUpdateDTO model = default!; public string SelectedOccurance { get; set; } public bool EndDateRequired { get; set; } = false; protected override void OnInitialized() { base.OnInitialized(); model = new(); editContext = new EditContext(model); } public void OpenTimeBlock(TimeBlockToUpdateDTO? timeBlockViewModel, Guid WorkitemId) { if (timeBlockViewModel == null) { model = new TimeBlockToUpdateDTO(); model.WorkitemId = WorkitemId; model.ContextOrgId = settingService.ContextOrgId(); model.CreatedById = settingService.UserId(); model.StartDate = DateOnly.FromDateTime(DateTime.UtcNow); model.EndDate = DateOnly.FromDateTime(DateTime.UtcNow); model.From = TimeOnly.FromDateTime(RoundUpToNearestHalfHour(DateTime.UtcNow)); model.To = model.From.AddMinutes(25); model.TimeBlockPattern = TimeBlockPattern.OneTime; } IsOpen = true; StateHasChanged(); } private DateTime RoundUpToNearestHalfHour(DateTime dateTime) { int minutes = dateTime.Minute; int addMinutes = 30 - (minutes % 30); if (addMinutes == 30) { addMinutes = 0; } return dateTime.AddMinutes(addMinutes).AddSeconds(-dateTime.Second).AddMilliseconds(-dateTime.Millisecond); } public void CloseDialog() { IsOpen = false; StateHasChanged(); } public async void UpdateTimeBlock() { if (model.TimeBlockPattern == TimeBlockPattern.Weekly) { if ((model.WeeklyProperties != null && model.WeeklyProperties.RecurrenceDaysOfWeek!=null) && model.WeeklyProperties.RecurrenceDaysOfWeek.Count() == 0) { return; } } try { var responseAPI = await Service.TimeBlockAPIClient.CreateOrUpdateTimeBlock(model); if (responseAPI.IsSuccess) { await OnSaveTimeBlock.InvokeAsync(model); CloseDialog(); ShowSuccessMessage(baseLocale["ToastUpdateWorkItem"].Value); } else { ShowErrorMessage(baseLocale["ToastErrorWorkItem"].Value); } } catch (Exception ex) { ShowErrorMessage(baseLocale["ToastErrorWorkItem"].Value); } } public void OnStartDateChange(DateOnly? dateOnly) { if (dateOnly != null) { model.StartDate = (DateOnly)dateOnly; } } public void OnEndDateChange(DateOnly? dateOnly) { if (dateOnly != null) { model.EndDate = (DateOnly)dateOnly; } } public void OnStartTimeChange(TimeOnly timeOnly) { model.From = timeOnly; } public void OnEndTimeChange(TimeOnly timeOnly) { model.To = timeOnly; } public void OnChangeInput(int value) { } public void OnOccuranceChange(string value) { Enum.TryParse(value, out TimeBlockPattern myStatus); if (model.TimeBlockPattern == myStatus) { EndDateRequired = false; } else { EndDateRequired = true; } } public void OnSelectWeek(DaysOfWeekEnum value) { int selectedvalue = (int)value; if (model.WeeklyProperties == null) { model.WeeklyProperties = new abcde.lib.DTOs.WorkItemDTOs.TimeBlockPropertiesDTOs.WeeklyPropertiesDTO(); model.WeeklyProperties.RecurrenceDaysOfWeek = new List<int>(); } if (model.WeeklyProperties.RecurrenceDaysOfWeek != null) { if (model.WeeklyProperties.RecurrenceDaysOfWeek.Contains(selectedvalue)) { model.WeeklyProperties.RecurrenceDaysOfWeek.Remove(selectedvalue); } else { model.WeeklyProperties.RecurrenceDaysOfWeek.Add(selectedvalue); } } } void ChangeSelection() { if (model.TimeBlockPattern == TimeBlockPattern.Daily && model.DailyProperties is null) { model.DailyProperties = new DailyPropertiesDTO { Interval = 1 }; } else if (model.TimeBlockPattern == TimeBlockPattern.Weekly && model.WeeklyProperties is null) { model.WeeklyProperties = new WeeklyPropertiesDTO { RecurrenceDaysOfWeek = new() }; } else if (model.TimeBlockPattern == TimeBlockPattern.Monthly && model.MonthlyProperties is null) { model.MonthlyProperties = new MonthlyPropertiesDTO { Interval = 1 }; } else if (model.TimeBlockPattern == TimeBlockPattern.Yearly && model.YearlyProperties is null) { model.YearlyProperties = new YearlyPropertiesDTO { Interval = 1 }; } else if (model.TimeBlockPattern == TimeBlockPattern.OneTime) { } }}The save on btn click throws no exception an all inputs should be valid:
As I said it seems to use no custom validation settings on the dto only the default one as () => default says
Trying to find out custom validation on Dto, has none. Try to see if it throws exception onsubmit, does not. Check if the data is valid, all valid. Did not find any extra validation class.