How to remove createAnother button from createOptionAction modal?
In a Form Select field, when I want to add the abilitiy to create another option on the relationship, it only makes sense in some cases to add one extra option that needs to be selected by the select field. Here I do not want to see the "Create & create another" action in my modal, as this only confuses the end user.
This does not work:
As:
How can we remove this action from the createOptionAction modal?
Solution:Jump to solution
Okay, so that cleared it up. in the
getCreateOptionAction()
method in the filament/packages/forms/src/Components/Select.php
class, an extra modal footer action is added conditionally:
```php
->extraModalFooterActions(fn (Action $action, Select $component): array => $component->isMultiple() ? [
$action->makeModalSubmitAction('createAnother', arguments: ['another' => true])
->label(__('filament-forms::components.select.actions.create_option.modal.actions.create_another.label')),...6 Replies
Hmm can you provide the whole code because I am not seeing tha ton my table createAction?
example:
Has no 'Create Another' option.
Ahh.. It only does that when you use a ->multiple() select field.
example:
you'll need to intercept extraModalFooterActions and remove it
Solution
Okay, so that cleared it up. in the
getCreateOptionAction()
method in the filament/packages/forms/src/Components/Select.php
class, an extra modal footer action is added conditionally:
So this is a way to remove it:
exactly 🙂
Strange that this is forced on the modal like that, without an option to disable it here. But hey ho, this works