Search code examples
laravel-backpack

Js field manipulation in inline modal


It is possible to manipulate fields in inline create modal with Javascript?

I have several inline create fields like that

CRUD::addField([
            'type' => "relationship",
            'name' => 'authors', 
            'ajax' => true,
            'attribute' => 'fullName',
            'inline_create' => [
                'entity' => 'author',
                ] 
        ]);

I tried using crud.field('authors').subfield('name') but doesn'r work


Solution

  • You need to add the script widget with ->inline().

    For example:

    Widget::add()->type('script')->content('assets/js/products/inline-fields.js')->inline();
    
    

    Note that you need to add this script in the setupCreateOperation of the related crud you create inside the modal.

    Cheers