F
Filament5mo ago
EMMAN

How can to disable 'create & create another' button on createOptionForm

Good day guys. How can i disable 'create & create another' button on createOptionForm Forms\Components\Select::make('owner_id') ->relationship('owner', 'name') ->searchable() ->preload() ->createOptionForm([ Forms\Components\TextInput::make('name') ->required() ->maxLength(255), Forms\Components\TextInput::make('email') ->label('Email address') ->email() ->required() ->maxLength(255), Forms\Components\TextInput::make('phone') ->label('Phone number') ->tel() ->required(), ]) ->required() TYSM.
11 Replies
ddoddsr
ddoddsr5mo ago
Give this a try.
CreateAction::make()
->createAnother(false)
CreateAction::make()
->createAnother(false)
jaocero
jaocero5mo ago
protected static bool $canCreateAnother = false;
protected static bool $canCreateAnother = false;
Add this in your create resource
EMMAN
EMMANOP5mo ago
this method is not working.
ddoddsr
ddoddsr5mo ago
jaocero is correct
protected static bool $canCreateAnother = false;
protected static bool $canCreateAnother = false;
in the create resource
Dennis Koch
Dennis Koch5mo ago
Probably:
->createOptionAction(
fn (Action $action) => $action->createAnother(false)
)
->createOptionAction(
fn (Action $action) => $action->createAnother(false)
)
EMMAN
EMMANOP5mo ago
not working sir @Dennis Koch exact code: ->createOptionAction( fn (\Filament\Forms\Components\Actions\Action $action) => $action->createAnother(false) ) ERROR: Method Filament\Forms\Components\Actions\Action::createAnother does not exist.
ddoddsr
ddoddsr5mo ago
Did you try
protected static bool $canCreateAnother = false;
protected static bool $canCreateAnother = false;
. in your create resource? Worked for me
Dennis Koch
Dennis Koch5mo ago
Can you please share a screenrecording? I just tried with the demo and createOption() doesn't even have a "Create and create another" button per default 🤔
EMMAN
EMMANOP5mo ago
good evening sir. @Dennis Koch current code: https://pastebin.com/Y3Jjhypd * in fn (\Filament\Forms\Components\Actions\Action $action) => $action->modalWidth('2xl') it works. but on fn (\Filament\Forms\Components\Actions\Action $action) => $action->createAnother(false) it gives error. please see the attachments:
Pastebin
Forms\Components\Select::make('mini...
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
No description
EMMAN
EMMANOP5mo ago
up
Dennis Koch
Dennis Koch5mo ago
Hm. I'm confused why you are having the "Create & create another option". That's not the default I have
Want results from more Discord servers?
Add your server