我制作了一个表单,其中输入表将通过 ajax 加载,具体取决于 create.blade.php 中“machine”下拉列表的选定值。
每当我提交表单并使用 dd($request) 时,它只返回以下内容:
array:5 [▼
"_token" => "KRCNWU8jxnT2RSrCrNOuGX9tfdC0TVUWxO3gKVCP"
"machine" => "14"
"breakdowndate" => null
"breakdowntime" => null
"Add" => "Submit"
]
创建.blade.php
<div id="add" class="modal fade" role="dialog">
<div class="modal-dialog modal-xl adjust-modal-xl">
<!-- Modal content-->
<div class="modal-content">
<!-- <div class="modal-header text-center">
</div> -->
<div class="modal-body">
<form class="form-horizontal" action="{{url('breakdown/store')}}" method="POST" id="add-form">
{{csrf_field()}}
@if (count($errors->store) > 0)
<div class="alert alert-danger">
<ul>
@foreach ($errors->store->all() as $error)
<li class="small">{{ $error }}</li>
@endforeach
</ul>
</div>
@endif
<div class="form-group row">
<label class="label-control col-lg-2">Machine:</label>
<div class="col-lg-4">
<select name="machine" id="machine" class="form-control chosen-select">
<option value=""></option>
@forelse($machines as $machine)
<option value="{{$machine->id}}">({{$machine->section}}) {{$machine->machine_no}}</option>
@empty
@endforelse
</select>
</div>
</div>
三国纷争