【发布时间】:2018-01-22 14:23:35
【问题描述】:
我试图做到这一点,以便当用户选择一个复选框然后点击一个按钮(未在下面的代码中显示)时,他们将被重定向到其中包含某些详细信息的新页面。我需要为此获取asset.id 值。我的问题是我不确定从哪里开始获取这些值并使它们与submit 按钮一起使用。
HTML
<thead>
<tr>
<th>Select</th>
<th>Model</th>
<th>Asset Number</th>
<th>Warranty</th>
<th>Notes</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
{% for asset in assets %}
<tr>
<td><input type="checkbox"/></td>
<td>{{asset.model}}</td>
{% if loop.first %}<td class="tour-step tour-step-sixteen"><a href="/dashboard/it/asset/{{asset.id}}">{{ prefix }}{{asset.assetNumber}}</a></td>
{% else %}
<td><a href="/dashboard/it/asset/{{asset.id}}">{{ prefix }}{{asset.assetNumber}}</a></td>
{% endif %}
<td>{{asset.warranty | date("y-m-d")}}</td>
<td>{{asset.notes}}</td>
<td>
<form id="label-form" action="/dashboard/it/label/print" method="POST">
<button type="submit" class="btn btn-danger"><i class="fa fa-trash-o"></i></button>
</form>
</td>
</tr>
{% endfor %}
</tbody>
我还没有 JS,因为我不确定如何开始获取我需要的值以及如何将它们保存/传递到我的 POST 路由。即使是指导也很棒。
我现在已经花了 3.5 个小时在网上寻找,但我发现没有一个解决方案似乎是完整的,它们都缺少一些东西,或者是单个值而不是我需要的多个值。
【问题讨论】:
标签: javascript html checkbox input