F
Filamentβ€’16mo ago
papipsycho

Having a page with form and action button to save

Hello Guys, I'm trying to made a page, with a form inside, for now a simple form, But it doesn't draw the button for saving . So i've try to implement button by using Forms\Components\Actions::make([ Forms\Components\Actions\Action::make('SaveCompanyName') ->color('primary') ->action(function (Forms\Set $set, $state) { return $this->saveCompany(); }) ]) but if i do that it will won't resprect the validation of the form. so how can i do this ?
13 Replies
Dennis Koch
Dennis Kochβ€’16mo ago
Why don't you just use a normal form with a submit button? πŸ€”
papipsycho
papipsychoOPβ€’16mo ago
what do you mean by "normal" form ?
Dennis Koch
Dennis Kochβ€’16mo ago
Just a form and a submit button as in the form-builder docs. Not sure where you found that SaveAction
papipsycho
papipsychoOPβ€’16mo ago
my form is pretty "normal" according to me public function form(Form $form): Form { return $form ->schema([ TextInput::make('title')->required(), TextInput::make('slug'), RichEditor::make('content'), ]); } and from the blade file <x-filament-panels::page> {{ $this->form }} </x-filament-panels::page> if i do the code above, there is no save button
awcodes
awcodesβ€’16mo ago
because you didn't add one to your view. πŸ™‚
<form wire:submit="save">
{{ $this->form }}
<div class="mt-6">
<x-filament::button type="submit">Save</x-filament::button>
</div>
</form>
<form wire:submit="save">
{{ $this->form }}
<div class="mt-6">
<x-filament::button type="submit">Save</x-filament::button>
</div>
</form>
papipsycho
papipsychoOPβ€’16mo ago
Ok thanks, and there is any way to have 2 forms on one page, on both diffrent panel ?
papipsycho
papipsychoOPβ€’16mo ago
Btw i found a way
papipsycho
papipsychoOPβ€’16mo ago
Untitled - Pastebin
Pastebin.pl is a website where you can store code/text online for a set period of time and share to anybody on earth
papipsycho
papipsychoOPβ€’16mo ago
i used the function validate from livewire Ok it doesn't take the valiation from the form itself, but at least it validate and display the correct error message in case of issue
papipsycho
papipsychoOPβ€’16mo ago
papipsycho
papipsychoOPβ€’16mo ago
there one still on small issue, is i put the color primary but thoses button do not respect the right primary color, and fallback to default primary
josef
josefβ€’16mo ago
you can just use either two forms on one component as described in the docs, or use two components and put them on the same page (like breezy does)
Want results from more Discord servers?
Add your server