© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•2y ago•
59 replies
slamx_

How to call function inside custom form field

I'm new in writing a custom form field. I watched the laracast from Dan but I want to trigger some custom functions inside the Field Class. I tried a regular wire:click with naming the method but I get the following response:

Unable to call component method. Public method [$example] not found on component

This is my example form field:

namespace App\Forms\Components;

use Filament\Forms\Components\Field;

class CloudFileSelect extends Field
{
    protected string $view = 'forms.components.cloud-file-select';

    public function example()
    {
        dd('example');
    }
}
namespace App\Forms\Components;

use Filament\Forms\Components\Field;

class CloudFileSelect extends Field
{
    protected string $view = 'forms.components.cloud-file-select';

    public function example()
    {
        dd('example');
    }
}


And this is the view:
<x-dynamic-component
    :component="$getFieldWrapperView()"
    :field="$field"
>
    <div  class="z-10" x-data="{ state: $wire.$entangle('{{ $getStatePath() }}') }">
        <button class="button hover:cursor-pointer" type="button" wire:click="example()">Open Example</button>
    </div>
</x-dynamic-component>
<x-dynamic-component
    :component="$getFieldWrapperView()"
    :field="$field"
>
    <div  class="z-10" x-data="{ state: $wire.$entangle('{{ $getStatePath() }}') }">
        <button class="button hover:cursor-pointer" type="button" wire:click="example()">Open Example</button>
    </div>
</x-dynamic-component>


I would be happy if someone can help me or give me a good source with a comprehensive example for writing my own field.
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

Custom form field inside resource
FilamentFFilament / ❓┊help
3y ago
Validating additional fields inside a custom form field
FilamentFFilament / ❓┊help
3y ago
Re-rendering Livewire inside Custom Form Field
FilamentFFilament / ❓┊help
10mo ago
Use Filament Components inside custom Form Field?
FilamentFFilament / ❓┊help
3y ago
Next page