Custom Edit Form

Customize editor fields and validation while keeping the Scheduler's modal and save controls.

Custom fields and validators

The following example demonstrates a required handover note of at least ten characters. Open an appointment and choose Edit. Clear the note to test validation; Cancel leaves the appointment unchanged.

UTC

2026-12-02 – 2026-12-02

Wed, Dec 2

All day
08:0009:0010:0011:0012:0013:0014:0015:0016:0017:00

No changes saved · Requests: 0

      readonly formFactory: NgbSchedulerEditorFormFactory = event => new FormGroup({
  title: new FormControl(event.title, { nonNullable: true, validators: [Validators.required] }),
  description: new FormControl(event.description ?? '', {
    nonNullable: true, validators: [Validators.required, Validators.minLength(10)]
  }),
  allDay: new FormControl(!!event.allDay, { nonNullable: true }),
  start: new FormControl(event.allDay ? event.start : new Date(event.start).toISOString().slice(0, -1), { nonNullable: true }),
  end: new FormControl(event.allDay ? event.end : new Date(event.end).toISOString().slice(0, -1), { nonNullable: true })
});
// For offset timestamps, convert to UTC with new Date(value).toISOString().slice(0, -1).
// <ngb-scheduler [editorFormFactory]="formFactory" [editorFieldsTemplate]="fields.template" ... />
    

Form contract

editorFormFactory returns a fresh initialized form containing title, description, allDay, start and end controls. This example uses UTC without a trailing Z. For another editing zone, initialize local fields with ngbSchedulerLocalTime and use matching labels; see Timezones. The field-template context exposes the form, event and operation kind. Do not nest another form or duplicate Save/Cancel buttons.

The Scheduler checks form validity and event dates before persistence. Async validators must settle before saving. Custom domain fields and resource pickers are not mapped automatically. The application owns field labels and error descriptions; the library owns pending state, error summary, delete confirmation and modal focus.