The nested form feature ($form->hasMany()) is really powerful.
How should we disable the "New" or "Remove" buttons? Some scenarios would require to not allow these ..or conditionnally
i think i can use ->hasMany( ... )->setView('myview') to use another view and override... but I would strongly suggest that NestedForm has a method like disableNew and disableRemove or one for both.
@isometriq Would you care to explain how have you done this with a custom view?
@isometriq Don't worry, i got it, after thinking about your comment, thanks !!
@isometriq , Hi, well, you can't really use setView on this case because the $form->hasMany is an instance of FormNestedForm and NestedForm in this case doesn't have a setView method to replace its view.
So, you still can replace the view for get this done, but, it's gonna be used in your entire admin, you can't actually use a custom view just once, which is my case :C
Anyway, gonna wait for this.
Thanks !
@z-song Is it possible to disable new button in Hasmany form?
how disable new after add form ?
$form->hasMany('orders', function (Form\NestedForm $form) {
$form->text('id');
$form->text('description');
})
->disableCreate()
->disableDelete();
@fhferreira thanks a lot. The method you suggested is working.
Most helpful comment