© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•2y ago•
23 replies
nyannss

Get Relation Fieldset State / Set Outside State in Relationship Fieldset

Form resources that have fieldset relationship, how to get state that fieldset on outside?

just for example :

[
  Fieldset::make('User')
    ->relationship('users')
    ->schema([
      TextInput::make('name')
        ->required(),
    ]),
  TextInput::make('slug')
    ->dehydrateStateUsing(
        fn(string $state, callable $get) => Str::slug($get('user.name')) // <-- when get this, the value is null
      )
]
[
  Fieldset::make('User')
    ->relationship('users')
    ->schema([
      TextInput::make('name')
        ->required(),
    ]),
  TextInput::make('slug')
    ->dehydrateStateUsing(
        fn(string $state, callable $get) => Str::slug($get('user.name')) // <-- when get this, the value is null
      )
]


or set outside state in relationship fieldset

[
  Fieldset::make('User')
    ->relationship('users')
    ->schema([
      TextInput::make('name')
        ->required()
        ->reactive()
        ->live()
        ->afterStateUpdated( callable $set) => $set('slug', Str::slug($state))),
        // nothing happens
    ]),
  TextInput::make('slug')
    ->prefix(config('app.url') . "/profile/")
]
[
  Fieldset::make('User')
    ->relationship('users')
    ->schema([
      TextInput::make('name')
        ->required()
        ->reactive()
        ->live()
        ->afterStateUpdated( callable $set) => $set('slug', Str::slug($state))),
        // nothing happens
    ]),
  TextInput::make('slug')
    ->prefix(config('app.url') . "/profile/")
]
Solution
you should use
$set('../slug', Str::slug($state))
$set('../slug', Str::slug($state))
Jump to solution
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Nested Fieldset and relationship
FilamentFFilament / ❓┊help
3y ago
Form relation fields of same relation in different groups/Fieldset
FilamentFFilament / ❓┊help
3y ago
Relation manager not saving fieldset data
FilamentFFilament / ❓┊help
3y ago
Filament 3 Fieldset relationship not storing
FilamentFFilament / ❓┊help
4mo ago