Replies: 2 comments 3 replies
-
To give you a bigger picture of what I am trying to achieve here: Using the two select boxes, the user selects what API to query. I want the button to actually do the API request and display the result of the request in the KeyValueEntry below. If there is a simpler method of doing this, I will happily restructure everything ;-) I'm rewriting an app that was previously built in ZF1 with jQuery. (Yeah, the good old days...) The form simply postet to the same URL, and if there was a post request, the application called the API and rendered the result below the form. Now I'm trying my best to do the same thing in Filament - and I've been struggeling for days now. Everything around resources and their tables and forms is so easy and great in Filament, I could sing songs of praise all day. But when it comes to custom pages, it makes me want to pull my hair out ;-) |
Beta Was this translation helpful? Give feedback.
-
You mean something like this? public function form(Schema $schema): Schema
{
return $schema->schema([
Select::make('select1')
->live()
->default('option2')
->options([
'option1' => 'Option 1',
'option2' => 'Option 2',
'option3' => 'Option 3',
]),
Select::make('select2')
->live()
->options([
'optionA' => 'Option A',
'optionB' => 'Option B',
'optionC' => 'Option C',
]),
KeyValueEntry::make('response')
->state(fn (Get $get) => [
'select1' => $get('select1'),
'select2' => $get('select2'),
]),
])
->statePath('data');
} if you are using a form in a custom livewire component, don't forget to do this public function mount(): void
{
$this->form->fill();
} |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Package
Form builder
Package Version
v4
How can we help you?
Regarding to the v3 docs, it was possible to inject
Set $set
in to an Action like so:https://filamentphp.com/docs/3.x/forms/actions#form-component-action-utility-injection
When I do the same in v4 (using
$schemaSet
instead of$set
according to https://filamentphp.com/docs/4.x/actions/overview), I get this error:"Call to a member function makeSetUtility() on null"
My Action lives right in the middle of a form of a custom page:
When I remove the
Set $schemaSet
parameter from theaction()
call, the error message goes away.Is there another way to access the form's component and set its state without using the
$schemaSet
parameter? Or is this a bug and it should work? Then I will happily file a regular bug report.As an additional problem,
dd($data)
within the action function always returns an empty array. I suppose I should be able to get the current form data via$schemaGet
, but this also does not work.Beta Was this translation helpful? Give feedback.
All reactions