【发布时间】:2020-11-15 04:22:42
【问题描述】:
在绘制数值的页面,将数值输入到不同的字段后,只传递最后一个。
应该有 eg: 对于值 v1, v2, v3, v4, v5 和组 g1, g2 示例结果应该是 g1: v1, v3; g2:v2、v4、v5。
其实就是:g2: v5 来自上面的例子。
我在哪里犯了错误?我是初学者,所以代码中可能存在无意的错误。这是我的代码。
输入值。按下按钮时会出现新字段。
<div class="mx-auto position-relative form-wrapper">
<form method="post" id="form" action="{{route('randomizeValues.store')}}" name="form" class="form text-center"
data-response-message-animation="slide-in-left" novalidate>
@csrf
<div id="parent" class="list-group">
<div class="form-group form-filed horizontal">
<input name="values" class="input" type="text" autocomplete="off" placeholder="Enter value"
autofocus onkeypress='validate(event)' onkeydown="pressEnter(event)" required>
</div>
</div>
<div id="parent" class="list-group">
<div class="form-group form-filed horizontal">
<input name="groups" class="input" type="text" autocomplete="off" placeholder="Enter group"
autofocus onkeypress='validate(event)' onkeydown="pressEnter(event)" required>
</div>
</div>
<button type="submit" class="btn btn-lg btn-alternate align-center">Draw</button>
在表格中显示结果。
<div class="section-heading text-center">
<h2>The following groups of results were drawn:</h2>
@foreach ($values_json as $value => $val)
<table class="table table-responsive">
<thead>
<tr>
<th style="width: 16.66%" scope="col">{{$value}}</th>
</tr>
</thead>
<tbody>
@foreach($val as $v)
<td> {{$v}}
{{$loop->last? "": " " }} </td>
@endforeach
</tbody>
</table>
@endforeach
<form method="post" id="form" action="{{route('randomizeValue.store')}}" name="form"
class="form text-center" data-response-message-animation="slide-in-left" novalidate>
@csrf
<button type="submit" class="btn btn-lg btn-alternate align-center">Draw again</button>
<a href="/randomizeValue" id="destroySession" type="submit"
class="btn btn-lg btn-alternate align-center">Cancel</a>
</form>
</div>
</form>
</div>
【问题讨论】:
标签: javascript css laravel laravel-blade