Can afterStateHydrated know if new record or editing?
When using the
afterStateHydrated
on a select field in a form, can you know if it's in the modal for creating a new record or updating an existing one?
I only want to set the pre-selected value of parent_id
when creating a new record through the 'simple' resource manager but not when editing an existing record so the value of an existing records parent_id doesn't accidentally change.
3 Replies
$context should be available as an argument. then you can check:
or default
Thanks, I now see this is described in the Advanced Forms documentation! https://filamentphp.com/docs/2.x/forms/advanced