英文:
Js field manipulation in inline modal
问题
可以使用JavaScript来操作内联创建模态框中的字段吗?
我有几个类似的内联创建字段,例如:
CRUD::addField([
'type' => "relationship",
'name' => 'authors',
'ajax' => true,
'attribute' => 'fullName',
'inline_create' => [
'entity' => 'author',
]
]);
我尝试使用 crud.field('authors').subfield('name')
但不起作用。
英文:
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
答案1
得分: 0
你需要使用 ->inline()
方法添加脚本小部件。
例如:
Widget::add()->type('script')->content('assets/js/products/inline-fields.js')->inline();
请注意,您需要在创建模态框内的相关CRUD的 setupCreateOperation
中添加此脚本。祝好运!
英文:
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
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论