验证表单中的字段 [英] Validation of fields in a form

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

问题描述

我对表单中某些字段的某些验证存在问题。


我有一些字段只有在选择特定字段时才会显示。


例如:


[HTML]< select name =" u_global ___ delivery_form" onchange =" document.getElementById(''array_div'')。sty le.display =(this.selectedIndex> 1)?''block'':''none'';" >

< option value =" 0" selected =" selected">< / option>

< option value =" Single board"> Single board< / option>

< option value =" Array"> Array< / option>

< / select> [/ HTML]


如果您选择数组 ;在我的表单中,其他字段变为可见:


[HTML]< div id =" array_div" style =" display:none;">

< table width =" 100%"边界=" 1 QUOT; CELLSPACING = QUOT; 0" CELLPADDING = QUOT; 0" style =" border-style:none;">

< tr>

< td height =" 25"对齐= QUOT;中心" VALIGN = QUOT;顶"列跨度= QUOT; 3英寸style =" padding-top:5px; padding-bottom:0px; border-style:none;">< img src =" ../ images / array.gif">< / td>

< / tr>

< tr>

< td width =" 44%"对齐= QUOT;右" VALIGN = QUOT;顶" style =" padding-right:5px; padding-top:5px; border-style:none;">数组大小X< / td>

< td width =" 50%"对齐= QUOT;左" VALIGN = QUOT;顶"风格= QUOT; padding-top:5px;下边框样式:无;左边框风格:无;右边框的颜色:#E0A70D; border-top-style:none;">< input name =" u_subpanel ___ array_x"类型= QUOT;文本" size =" 15">< / td>

< / tr>

< tr>

< td align = QUOT;右" VALIGN = QUOT;顶" style =" padding-right:5px; border-style:none;">数组大小y< / td>

< td align =" left" VALIGN = QUOT;顶"风格= QUOT;边界底式:无;左边框风格:无;右边框的颜色:#E0A70D; border-top-style:none;">< input name =" u_subpanel ___ array_y"类型= QUOT;文本" size =" 15">< / td>

< / tr>

< tr>

< td align = QUOT;右" VALIGN = QUOT;顶" style =" padding-right:5px; border-style:none;">每个数组的板数X< / td>

< td align =" left" VALIGN = QUOT;顶"风格= QUOT;边界底式:无;左边框风格:无;右边框的颜色:#E0A70D; border-top-style:none;">< input name =" u_subpanel ___ array_num_x"类型= QUOT;文本" size =" 15">< / td>

< / tr>

< tr>

< td align = QUOT;右" VALIGN = QUOT;顶" style =" padding-right:5px; border-style:none;">每个数组的板数y< / td>

< td align =" left" VALIGN = QUOT;顶"风格= QUOT;边界底式:无;左边框风格:无;右边框的颜色:#E0A70D; border-top-style:none;">< input name =" u_subpanel ___ array_num_y"类型= QUOT;文本" size =" 15">< / td>

< / tr>

< tr>

< td align = QUOT;右" VALIGN = QUOT;顶" style =" padding-right:5px; border-style:none;"> Board seperation< / td>

< td align =" left" VALIGN = QUOT;顶"风格= QUOT;边界底式:无;左边框风格:无;右边框的颜色:#E0A70D; border-top-style:none;">< select name =" u_subpanel ___ board_sep">

< option selected =" selected">< / option>

< option value =" Break routing"> Break routing< / option>

< option value =" Scoring"> Scoring< / option>

< option value =" Break routing + Scoring"> Both< / option>

< / select> < / td>

< / tr>

< tr>

< td align =" right" VALIGN = QUOT;顶" style =" padding-right:5px;底部边框颜色:#E0A70D;左边框风格:无;右边框样式:无; border-top-style:none;">所需的面食数据< / td>

< td align =" left" VALIGN = QUOT;顶"风格="左边框风格:无;右边框的颜色:#E0A70D;底部边框颜色:#E0A70D; border-top-style:none;">< input onClick =" javascript :getDiv6();"命名= QUOT; u_subpanel ___ pasta_req"类型= QUOT;无线电"值= [否" style =" border-style:none;"> No& nbsp;& nbsp;< input name =" u_subpanel ___ pasta_req" ID = QUOT; tin_array"类型= QUOT;无线电"值= QUOT;是"风格="边框样式:无;" onClick =" javascript :getDiv6();">是< / td>

< / tr>

< /表格>

< / div> [/ HTML]


现在,我的问题是只在用户选择的时候对新显示的字段进行验证"阵列"选项,如果字段不可见则不进行验证。


请帮助.........


非常感谢提前。

I have a problem with some validation of some fields in a form.

I have some fields that only become visible if a specific field is chosen.

For example:

[HTML]<select name="u_global___delivery_form" onchange="document.getElementById(''array_div'').sty le.display=(this.selectedIndex>1)?''block'':''none'';" >
<option value="0" selected="selected"></option>
<option value="Single board">Single board</option>
<option value="Array">Array</option>
</select>[/HTML]

Where if you select the "array" option in my form, additional fields become visible:

[HTML]<div id="array_div" style="display:none;">
<table width="100%" border="1" cellspacing="0" cellpadding="0" style="border-style:none;">
<tr>
<td height="25" align="center" valign="top" colspan="3" style="padding-top: 5px; padding-bottom: 0px; border-style:none;"><img src="../images/array.gif"></td>
</tr>
<tr>
<td width="44%" align="right" valign="top" style="padding-right: 5px; padding-top: 5px; border-style:none;">Array size X</td>
<td width="50%" align="left" valign="top" style=" padding-top: 5px; border-bottom-style:none; border-left-style:none; border-right-color:#E0A70D; border-top-style:none;"><input name="u_subpanel___array_x" type="text" size="15"></td>
</tr>
<tr>
<td align="right" valign="top" style="padding-right: 5px; border-style:none;">Array size y</td>
<td align="left" valign="top" style="border-bottom-style:none; border-left-style:none; border-right-color:#E0A70D; border-top-style:none;"><input name="u_subpanel___array_y" type="text" size="15"></td>
</tr>
<tr>
<td align="right" valign="top" style="padding-right: 5px; border-style:none;">Boards per array X</td>
<td align="left" valign="top" style="border-bottom-style:none; border-left-style:none; border-right-color:#E0A70D; border-top-style:none;"><input name="u_subpanel___array_num_x" type="text" size="15"></td>
</tr>
<tr>
<td align="right" valign="top" style="padding-right: 5px; border-style:none;">Boards per array y</td>
<td align="left" valign="top" style="border-bottom-style:none; border-left-style:none; border-right-color:#E0A70D; border-top-style:none;"><input name="u_subpanel___array_num_y" type="text" size="15"></td>
</tr>
<tr>
<td align="right" valign="top" style="padding-right: 5px; border-style:none;">Board seperation</td>
<td align="left" valign="top" style="border-bottom-style:none; border-left-style:none; border-right-color:#E0A70D; border-top-style:none;"><select name="u_subpanel___board_sep">
<option selected="selected"></option>
<option value="Break routing">Break routing</option>
<option value="Scoring">Scoring</option>
<option value="Break routing+Scoring">Both</option>
</select> </td>
</tr>
<tr>
<td align="right" valign="top" style="padding-right: 5px; border-bottom-color:#E0A70D; border-left-style:none; border-right-style:none; border-top-style:none;">Pasta data required</td>
<td align="left" valign="top" style="border-left-style:none; border-right-color:#E0A70D; border-bottom-color:#E0A70D; border-top-style:none;"><input onClick="javascript:getDiv6();" name="u_subpanel___pasta_req" type="radio" value="No" style="border-style:none;">No&nbsp;&nbsp;<input name="u_subpanel___pasta_req" id="tin_array" type="radio" value="Yes" style="border-style:none;" onClick="javascript:getDiv6();">Yes</td>
</tr>
</table>
</div>[/HTML]

Now, my problem is to only validate on the newly visible fields, when the user selects the "array" option and no validation if the fields do not become visible.

Please help.........

Thanks very much in advance.

推荐答案

无法检查要验证的显示样式
can''t u check the display style which is to be validated



不能检查要验证的显示样式
can''t u check the display style which is to be validated



不确定你的意思。你能给我一个例子....?

Not sure exactly what you mean by that. Can you give me an example....?


使用
展开 | 选择 | Wrap < span class =codeDivider> | 行号


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

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