表单中的多个数据集 [英] Multiple data sets in a form
问题描述
出于某种原因,我需要在提交包含共享名称的许多数据时检查表单的有效性。表单如下所示:
[HTML]< form id =" upload_form"名称= QUOT; upload_form" onsubmit =" return uploadCheckValid2()">
< table>
< tr>
< td> xxx< / td>
< / tr>
< tr>
< td>
< input type =" text"名称= QUOT;标题[]"值= QUOT; 10" />
< / label>< / td>
....
....
< / form> [/ HTML]
对于js:
For certain reason, I need to check the validity of a form when submit with many data with shared name. The form looks like this:
[HTML]<form id="upload_form" name="upload_form" onsubmit="return uploadCheckValid2()">
<table>
<tr>
<td>xxx</td>
</tr>
<tr>
<td>
<input type="text" name="title[]" value="10" />
</label></td>
....
....
</form>[/HTML]
For the js:
推荐答案
给你的输入节点一个id,并参考:
give your input-nodes an id and refer with:
每个表有10个输入,最多有5个表。所以你的方式有效,但代码很长。还有其他方法吗?
i have 10 inputs per table, and will have 5 tables in max. So your way works but will be very long in code. Any other ways?
你的意思是你想要检查所有输入节点是否相同?然后使用:
do you mean you want to check all input nodes for the same thing? then just use:
这篇关于表单中的多个数据集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!