【发布时间】:2020-10-26 12:32:09
【问题描述】:
我创建了三种不同的表单,它们需要分开,因为它们折叠在不同的按钮中。碰巧当我单击第三个表单上的提交按钮时,我希望我的控制器接收来自三个表单的数据。是否可以在 Laravel 中通过一次提交接收来自所有表单的输入数据?
每个表单都位于由数据目标标识的按钮内。示例:
<div class="container" id="myGroup">
<button class="btn btn-primary" type="button" data-toggle="collapse" data-target="#entidade" role="button" aria-expanded="false" aria-controls="entidade">
Entidades
</button>
<button class="btn btn-primary" type="button" data-toggle="collapse" data-target="#dirigente1" role="button" aria-expanded="false" aria-controls="dirigente1">
Dirigente 1
</button>
<button class="btn btn-primary" type="button" data-toggle="collapse" data-target="#dirigente2" role="button" aria-expanded="false" aria-controls="dirigente2">
Dirigente 2
</button>
<form class="collapse" id="entidade" data-parent="#myGroup" method="post" action="/entidades/store">
.
.
</form>
<form class="collapse" id='dirigente1' data-parent="#myGroup" method="post" action="/entidades/store">
.
.
</form>
<form class="collapse" id='dirigente2' data-parent="#myGroup" method="post" action="/entidades/store">
.
.
</form>
</div>
控制器:
public function store(Request $request){
}
【问题讨论】:
-
将其他 2 个表单元素放在第 3 个表单中,并在网页上有一个表单。
-
我不明白这怎么可能......你能举例说明吗?
标签: php laravel controller