© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•17mo ago•
7 replies
Adam Holmes

Inject other field state into viewData on ViewField

Hi,

I have a field that is
ToggleButtons
ToggleButtons
. I then have another field which is a
ViewField
ViewField
which I would like to regenerate depending on the option that is selected in the
ToggleButtons
ToggleButtons
field.

At the moment, the way that I do this is to use
$getRecord()
$getRecord()
in the view and then look at the value in the toggle field. The problem is that it only updates when the record is saved (as you would expect).

I'd like to look at the state as is in the form before saving but I can't find a way to do this because
view
view
and
viewData
viewData
do not accept a closure for me to pass
Get $get
Get $get
into it. I did attempt to find the field based on the
$form
$form
using
getComponent
getComponent
but with no luck

Any ideas on a simple solution for this?

Thanks
Solution
use in the view

{{ $evaluate(fn ($get) => $get('your_toggle')) }}
{{ $evaluate(fn ($get) => $get('your_toggle')) }}
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
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

ViewField -> ViewData variable not available
FilamentFFilament / ❓┊help
3mo ago
Viewfield not updating state
FilamentFFilament / ❓┊help
2y ago
how use viewData value at ViewField in the blade view
FilamentFFilament / ❓┊help
3y ago
Seeking Guidance on how to Inject Form State into Custom Layout
FilamentFFilament / ❓┊help
3y ago