© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
5 replies
WrkL

How to properly access relation data in ViewField

Hi, i am using a standalone form builder,
i have below ViewField
    ViewField::make('bin.bin_description')
      ->label('Bin')
      ->view('filament.forms.fields.span'),
    ViewField::make('bin.bin_description')
      ->label('Bin')
      ->view('filament.forms.fields.span'),


and this is the component :
  <x-dynamic-component 
    :component="$getFieldWrapperView()" 
    :id="$getId()" 
    :label="$getLabel()" 
    :label-sr-only="$isLabelHidden()" 
    :helper-text="$getHelperText()" 
    :hint="$getHint()" 
    :hint-action="$getHintAction()" 
    :hint-color="$getHintColor()" 
    :hint-icon="$getHintIcon()" 
    :required="$isRequired()" 
    :state-path="$getStatePath()"
  >
  <div x-data="{ state: $wire.entangle('{{ $getStatePath() }}').defer }">
    <span x-text="state ? state : 'abc'"></span>
  </div>
  </x-dynamic-component>
  <x-dynamic-component 
    :component="$getFieldWrapperView()" 
    :id="$getId()" 
    :label="$getLabel()" 
    :label-sr-only="$isLabelHidden()" 
    :helper-text="$getHelperText()" 
    :hint="$getHint()" 
    :hint-action="$getHintAction()" 
    :hint-color="$getHintColor()" 
    :hint-icon="$getHintIcon()" 
    :required="$isRequired()" 
    :state-path="$getStatePath()"
  >
  <div x-data="{ state: $wire.entangle('{{ $getStatePath() }}').defer }">
    <span x-text="state ? state : 'abc'"></span>
  </div>
  </x-dynamic-component>


it work if there is relation data for bin but it will throw below error in console if no relation data
image.png
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

Access data/record in ViewField
FilamentFFilament / ❓┊help
3y ago
How to access $data from relation manager in actions([])
FilamentFFilament / ❓┊help
3y ago
How to access Parent data to relation manager?
FilamentFFilament / ❓┊help
3y ago
How to access "TextInput" data from Resource to Relation manager?
FilamentFFilament / ❓┊help
3y ago