DxScheduler.ValidateEditForm Property

Specifies whether to validate the appointment edit form.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v20.2.dll

Declaration

[Parameter]
[DefaultValue(false)]
public bool ValidateEditForm { get; set; }

Property Value

Type Default Description
Boolean

false

true to validate the appointment edit form; otherwise, false.

Remarks

The edit form appears when you create or edit an appointment. Do the following to enable appointment form validation:

  1. Set the ValidateEditForm property to true.
  2. Implement a SchedulerAppointmentFormInfo class descendant and mark appointment properties with data annotation attributes.
  3. Handle the AppointmentFormShowing event and assign a custom descendant instance to the event argument's FormInfo property.
  4. (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);
    }
    // ...
}

Compact Appointment Form

Run Demo: Scheduler - Custom Fields and Appointment Form

Watch Video : Scheduler - Customization

See Also