jquery.formValidator 验证案例

这两天在使用验证的时候,一直找不到问题所在!验证的效果一直出不来,很郁闷,后来自己单独写了一个页面案例。却出来了,发现问题的所在是因为form嵌套的原因。

<form>

    <form>

    </form>

</form>

使用到的资源下载地址!

http://download.csdn.net/detail/vincent_void/4510738


做一下笔记,以防下次使用查找麻烦!


想要查看更全面的,请点击:http://www.cnblogs.com/aijun/archive/2011/03/21/1989991.html
使用AJAX验证,请看:http://www.cnblogs.com/MyFlora/archive/2012/05/03/2481395.html
原版地址:http://www.position-relative.net/creation/formValidator/demos/demoAjaxSubmitPHP.html

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="formValidate.aspx.cs" Inherits="formValidate" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script src="/js/jquery-1.3.2.min.js" type="text/javascript"></script>
    <link href="/css/validate/jquery.formvalidate.css" rel="stylesheet" type="text/css" />
    <script src="/js/jquery.formValidator/jquery.validationEngine.js" type="text/javascript"></script>
    <script src="/js/jquery.formValidator/languages/jquery.validationEngine-cn.js" type="text/javascript"></script>
</head>
<body>
    <div>
    <br /><br /><br /><br /><br /><br />
        <form method="post" action="formValidate.aspx" id="form" enctype="multipart/form-data">
        <table>
            <tr>
                <td class="name">
                    申请职位:
                </td>
                <td class="txt_right">
                    <input name="txt_man" id="txt_man" type="text" class="validate[required]" value="互联网产品经理"
                        maxlength="10" />
                </td>
                <td class="name">
                    姓名:
                </td>
                <td>
                    <input name="txt_name" id="txt_name" type="text" class="validate[required]" maxlength="13" />
                </td>
            </tr>
            <tr>
                <td class="name">
                    联系方式:
                </td>
                <td class="txt_right">
                    <input name="txt_tel" id="txt_tel" type="text" class="validate[required]" maxlength="13" />
                </td>
                <td class="name">
                    简历上传:
                </td>
                <td>
                    <input name="txt_file" id="txt_file" type="file" class="validate[required]" />
                </td>
            </tr>
            <tr>
                <td colspan="4" align="center">
                    <input type="button" id="btn_Sure" class="button" value="确认" />
                    <input type="reset" class="button" value="取消" />
                </td>
            </tr>
        </table>
        </form>
    </div>
</body>
</html>

<script>
    $(function () {
        //验证插件
        $("#form").validationEngine({
            inlineValidation: false,
            success: false,
            failure: false,
            promptPosition: 'topRight'
        });
    })
    $("#btn_Sure").click(function () {
       
        if (!$('#form').validationEngine('validate')) {
            return;
        }
        $("#form").submit();
    })
</script>

使用过程中出现异步提交问题,无法验证


AJAX 异步提交问题
http://btstream.is-programmer.com/posts/32470.html   


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值