JQuery验证引擎在带有主文件的ASP页面中不起作用 [英] JQuery validation Engine not working in ASP Page With Master File

查看:113
本文介绍了JQuery验证引擎在带有主文件的ASP页面中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从以下位置下载了此jquery验证引擎 http://www. position-absolute.com/articles/jquery-form-validator-因为表单验证是is-a-mess/

I downloaded this jquery validation engine from http://www.position-absolute.com/articles/jquery-form-validator-because-form-validation-is-a-mess/

确认密码验证之外,所有验证均正常运行, 密码是否匹配.

All validation is Working fine except Confirm Password validation it validates all the time wheather password is matching or not.

验证在单个页面上有效,但在母版页的内容页面上不起作用.

validation works perfecrt on individual page but its not working in content page of the master page.

请帮助我...

.aspx文件

<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<script src="Styles/jquery-1.6.min.js" type="text/javascript"></script>
    <script src="Styles/jquery.validationEngine-en.js" type="text/javascript"></script>
    <script src="Styles/jquery.validationEngine.js" type="text/javascript"></script>
    <link href="Styles/validationEngine.jquery.css" rel="stylesheet" type="text/css" />
     <script type="text/javascript">
         jQuery(document).ready(function () {
             // binds form submission and fields to the validation engine
             jQuery("#form1").validationEngine();
         });
     </script>
     <form id="form1" runat="server">
     <br />
     <br />
     <br />
     <asp:TextBox ID="TextBox1" runat="server" class="validate[required] text-input"></asp:TextBox>
    <br /><asp:TextBox ID="TextBox2" runat="server" class="validate[required,equals[TextBox1]] text-input"></asp:TextBox>
    <br />
    <asp:Button ID="Button1" runat="server" Text="Button" />

      </form>
</asp:Content>

推荐答案

.net呈现时,它会更改Form ID,因此请不要使用:

When .net renders it changes the Form id so instead of using:

jQuery("#form1").validationEngine(); 

请使用:

jQuery("form").validationEngine();

获取视图源并获取表单ID并将其放置在此处

for view source and get the id of your form and place it there

这篇关于JQuery验证引擎在带有主文件的ASP页面中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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