© 2026 Hedgehog Software, LLC

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

Accessing a form component from another

Hello,
I would like to know if it is possible to access another component from a component. For example, I'd like to modify the
placeholder
placeholder
of a
TextInput
TextInput
according to a record field selected in a
Select
Select
.

I tried something like this, I can access the other component, but
getSelectedRecord
getSelectedRecord
is still null, as if the state didn't change
[
    Forms\Components\Select::make('object_id'),
    Forms\Components\TextInput::make('title')
        ->placeholder(fn(HasForms $livewire) => $livewire
            ->getForm('form')
            ?->getComponent('object_id')
            ->getSelectedRecord()
            ?->getAttribute('something')
]
[
    Forms\Components\Select::make('object_id'),
    Forms\Components\TextInput::make('title')
        ->placeholder(fn(HasForms $livewire) => $livewire
            ->getForm('form')
            ?->getComponent('object_id')
            ->getSelectedRecord()
            ?->getAttribute('something')
]


I've got this working, but I'd like if possible to avoid redoing an SQL request for nothing.

[
    Forms\Components\Select::make('object_id'),
    Forms\Components\TextInput::make('title')
        ->placeholder(fn(Forms\Get $get) => Object::find($get('object_id'))->something)
]
[
    Forms\Components\Select::make('object_id'),
    Forms\Components\TextInput::make('title')
        ->placeholder(fn(Forms\Get $get) => Object::find($get('object_id'))->something)
]


TY !
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

call component from another component
FilamentFFilament / ❓┊help
2y ago
Accessing form $data from an action using Livewire::make() form component in a modal
FilamentFFilament / ❓┊help
2y ago
Open another form modal from a form modal
FilamentFFilament / ❓┊help
10mo ago
i need to pass a form component as parameter to another form component
FilamentFFilament / ❓┊help
2y ago