DxScheduler.ValidateEditForm Property
Specifies whether to validate the appointment edit form.
Namespace: DevExpress.Blazor
Assembly: DevExpress.Blazor.v24.2.dll
NuGet Package: DevExpress.Blazor
Declaration
[DefaultValue(false)]
[Parameter]
public bool ValidateEditForm { get; set; }
Property Value
Type | Default | Description |
---|---|---|
Boolean | false |
|
Remarks
The edit form appears when you create or edit an appointment. Follow the steps below to enable appointment form validation:
- Set the
ValidateEditForm
property totrue
. - Implement a SchedulerAppointmentFormInfo class descendant and mark appointment properties with data annotation attributes.
- Handle the AppointmentFormShowing event and assign a custom descendant instance to the event argument’s FormInfo property.
- (Optionally) Use AppointmentFormLayout and AppointmentCompactFormLayout properties to create custom edit forms. Add the DxSchedulerCustomFormLayoutItem to the form layout and use the ValidationSummary component in the item template to display validation messages.
<DxScheduler StartDate="@DateTime.Today"
DataStorage="@DataStorage"
ActiveViewType="SchedulerViewType.WorkWeek"
AppointmentFormShowing="OnAppointmentFormShowing"
ValidateEditForm="true">
@*...*@
<AppointmentCompactFormLayout>
@*...*@
<DxSchedulerCustomFormLayoutItem ColSpanMd="12">
<Template>
<ValidationSummary />
</Template>
</DxSchedulerCustomFormLayoutItem>
</AppointmentCompactFormLayout>
</DxScheduler>
@code {
public class CustomAppointmentFormInfo : SchedulerAppointmentFormInfo {
public CustomAppointmentFormInfo(DxSchedulerAppointmentItem AppointmentItem,
DxSchedulerDataStorage DataStorage) : base(AppointmentItem, DataStorage) { }
[Required]
public override string Subject {
get { return base.Subject; }
set { base.Subject = value; }
}
// ...
}
void OnAppointmentFormShowing(SchedulerAppointmentFormEventArgs args) {
args.FormInfo = new CustomAppointmentFormInfo(args.Appointment, DataStorage);
}
// ...
}
See Also