表单中的多个数据集 [英] Multiple data sets in a form

查看:59
本文介绍了表单中的多个数据集的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

出于某种原因,我需要在提交包含共享名称的许多数据时检查表单的有效性。表单如下所示:


[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:

展开 | < span class =codeLinkonclick =selectAll(this);>选择 | Wrap | 行号


每个表有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:

展开 | 选择 | Wrap | 行号


这篇关于表单中的多个数据集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆