<?phpnamespace App\Filament\Pages\XXX;use Filament\Actions\Action;use Filament\Forms\Components\TextInput;use Filament\Forms\Concerns\InteractsWithForms;use Filament\Forms\Contracts\HasForms;use Filament\Forms\Form;use Filament\Forms\Set;use Filament\Notifications\Notification;use Filament\Pages\Page;class CreateXXX extends Page implements HasForms{ use InteractsWithForms; public ?array $data = []; protected static string $view = 'filament.pages.xxx'; public function mount(): void { $this->form->fill(); } public function form(Form $form): Form { return $form ->schema([ TextInput::make('name') ->autofocus(), ]) ->statePath('data'); } protected function getFormActions(): array { return [ Action::make('create') ->label(__('filament-panels::resources/pages/create-record.form.actions.create.label')) ->submit('create'), Action::make('clear') ->action(function (Set $set) { dd(1); $set('data.name', '',); $set('name', ''); $this->form->fill(); }) ]; } public function create(): void { $this->form->fill(); Notification::make() ->success() ->title('OK') ->send(); }}
<x-filament-panels::page @class([ 'fi-resource-create-record-page', ])> <x-filament-panels::form id="form" wire:submit="create" > {{ $this->form }} <x-filament-panels::form.actions :actions="$this->getFormActions()" /> </x-filament-panels::form></x-filament-panels::page>
CheckboxList::make('options') ->options([ 'a' => 'A', 'b' => 'B', 'c' => 'C', 'd' => 'D', ]) ->live() ->disableOptionWhen(function($value, Set $set, $state) { if(in_array('a', $state)) { //if($value === 'a') { # value is allways a...? $set('options.b', false); } }),
->live(debounce:400) ->autocomplete('off') ->datalist(function(Set $set, $state) { $data = []; if($state != null) { $data = (new MyService())->autocomplete($state); } return $data; })