F
Filament4mo 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
ddoddsr4mo ago
Give this a try.
CreateAction::make()
->createAnother(false)
CreateAction::make()
->createAnother(false)
jaocero
jaocero4mo ago
protected static bool $canCreateAnother = false;
protected static bool $canCreateAnother = false;
Add this in your create resource
EMMAN
EMMANOP4mo ago
this method is not working.
ddoddsr
ddoddsr4mo ago
jaocero is correct
protected static bool $canCreateAnother = false;
protected static bool $canCreateAnother = false;
in the create resource
Dennis Koch
Dennis Koch4mo ago
Probably:
->createOptionAction(
fn (Action $action) => $action->createAnother(false)
)
->createOptionAction(
fn (Action $action) => $action->createAnother(false)
)
EMMAN
EMMANOP4mo 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
ddoddsr4mo ago
Did you try
protected static bool $canCreateAnother = false;
protected static bool $canCreateAnother = false;
. in your create resource? Worked for me
Dennis Koch
Dennis Koch4mo 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
EMMANOP4mo 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
EMMANOP4mo ago
up
Dennis Koch
Dennis Koch4mo 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