Skip to main content

PHP change callbacks

onChange() uses the regular Filament state-update lifecycle. live() sends the change to PHP immediately. Without it, the normal field binding/request timing applies. The callback receives the field state in its configured saved format; ranges receive an endpoint array.

Native-compatible callback API

Use normal Filament closure injection ($state, $old, Get, Set, the component or record) where supported. Programmatically filling a field does not automatically behave like a user change.

Dependent date limits

Updating the start date refreshes the second field’s lower bound. An existing end date below the new limit remains invalid until corrected; it is not silently rewritten.

Range state

Calendar range changes are confirmed by Apply. Hovering a day, moving the cursor or cancelling a draft does not replace the stored range. Guided manual editing updates its segments as the visitor types; an incomplete draft must still be rejected by validation.

Built-in checks

required() checks empty scalar values and empty range endpoints. Optional empty values remain allowed. Invalid nonempty input is not a valid empty field.

Business validation

This adds a divisibility rule on top of normal clock validation. For a fixed appointment list, allowedTimes() is simpler.

Custom error text

The malformed-value message is distinct from bound/availability errors. Translate package messages in your application if you want to change their wording consistently. isInvalid() changes visual state only; it does not replace validation.

Browser events

Listen on the field wrapper or an ancestor. Events bubble and are scoped to the control that emitted them. Browser listeners do not invoke PHP callbacks by themselves. value uses the saved format; canonical is the normalized day/local date-time representation. Partial segment input may carry an incomplete marker in value and valid: false; use change/validation to act on completed selections. PHP can still receive incomplete drafts when a field is live, so validate before performing business actions.
Remove listeners when your application removes their owner. These are application events, not a separate upload/booking API.

Reservation safety

Date availability is a selection aid. Another visitor can book the same slot after your calendar loaded. Recheck the date, slot, authorization and capacity in the save transaction. Timezone offsets and daylight-saving ambiguities must be resolved according to your application’s policy when converting local date/time values to instants.
Last modified on October 16, 2026