简体   繁体   English

Microsoft JScript运行时错误:对象不支持属性或方法“ validate”

[英]Microsoft JScript runtime error: Object doesn't support property or method 'validate'

This issue is that i am getting the error, Microsoft JScript runtime error: Object doesn't support property or method 'validate'. 这个问题是我遇到错误,Microsoft JScript运行时错误:对象不支持属性或方法“ validate”。 Couldn't figure out why. 不知道为什么。 Any suggestions? 有什么建议么?

<form id="ContactUs" class="float-left" autocomplete="off">
    <div class="box-content">
            <div id="Department-List" class="field clearfix">            
                <select id="DepartmentList" size="1" name="DepartmentList" class="required">
                   <% foreach(var options in (List<string>)ViewBag.DepartmentList) { %>
                        <option id="<%:options%>" value="<%:options%>" ><%:options%></option>
                    <% } %>
                </select>
            </div>
            <div class="field clearfix">
                <label class="float-left">NAME:</label>
                <input type="text" id="Name" class="required full-width text radi-4" minlength="3"/>
            </div>
            <div class="field clearfix">
                <label class="float-left">PHONE:</label>
                <input type="text" id="Phone" class="required PhoneNumbers full-width text radi-4" />
            </div>
            <div class="field clearfix">
                <label class="float-left">EMAIL:</label>
                <input type="text" id="SendersEmail" class="required email full-width text radi-4"/>
            </div>
            <div class="field clearfix">
                <label class="float-left">ACCOUNT #:</label>
                <input type="text" id="AccountNumber" class="full-width text radi-4" />
            </div>
            <div class="field clearfix">
                <label class="float-left">QUESTIONS:</label>
                <textarea id="QuestionBox" rows="4" cols="25" class="required full-width text radi-4"></textarea>
            </div>


            <div class="field clearfix">
                <input id="submit-inventory-request-button" type="submit" name="Submit" value="Send" class="submit next-step toggle-btn radi-3 arrow-icon" />
            </div>

When I am trying to submit the form I am getting the error from $('#ContactUs').validate() function. 当我尝试提交表单时,我从$('#ContactUs')。validate()函数获取错误。

 <script type="text/javascript">

     $(document).ready(function () {
         $('#ContactUs').validate({
            errorElement: 'span',
            success: 'valid',
            error: 'error',
            submitHandler: function() {

                var contact = {
                    DepartmentList: $('#DepartmentList').val()
                        , Name: $('#Name').val()
                        , Phone: $('#Phone').val()
                        , SendersEmail: $('#SendersEmail').val()
                        , RequestersEmail: $('#RequestersEmail').val()
                        , AccountNumber: $('#AccountNumber').val()
                        , QuestionBox: $('#QuestionBox').val()
                        , TermsCheckBox: $('#TermsCheckBox').val()
                };
                var req;
                req = DT.ajaxData('/Ajax/ContactUs/', 'POST', JSON.stringify(contact));

                // if the ajax request is successful, then display the success message and redirect the page
                req.done(function(data) {
                    console.log(data);
                    $("#partial").dialog('close');
                    $("#SuccessMessage").dialog({ buttons: { "Ok": function() { $(this).dialog("close"); } } });
                });

                return false;

            }
        });
    })

There is no built-in jQuery function named validate . 没有名为validate内置jQuery函数。 It's available from several plugins though. 它可以从几个插件中获得。 For example 例如

Have you properly included the plugin's in your page? 您是否在页面中正确包含了插件的内容?

If using Visual Studio the simplest way is to use the NuGet extension to download jQuery. 如果使用Visual Studio,最简单的方法是使用NuGet扩展来下载jQuery。 If you don't have it you can find it at www.codeplex.com and install it. 如果没有它,可以在www.codeplex.com上找到并安装它。 Then go to Tools -> Library Package Manager -> Manage NuGet Packages within Visual Studio and search for jQuery. 然后转到Visual Studio中的“工具”->“库软件包管理器”->“管理NuGet软件包”并搜索jQuery。 Once this is installed, the Script folder within your project will have the required files. 安装完成后,项目中的Script文件夹将具有所需的文件。

Modify the path within your view.cshtml file to point to the current version of jQuery eg 1.7.1 in this case 修改view.cshtml文件中的路径以指向jQuery的当前版本,例如1.7.1

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Microsoft JScript运行时错误:对象不支持此属性或方法 - Microsoft JScript runtime error: Object doesn't support this property or method Microsoft JScript运行时错误:对象不支持此属性或方法 - Microsoft JScript runtime error: Object doesn't support this property or method Microsoft JScript运行时错误:对象不支持属性或方法&#39;addEventListener&#39; - Microsoft JScript runtime error: Object doesn't support property or method 'addEventListener' Microsoft JScript运行时错误:对象不支持属性或方法“ val” - Microsoft JScript runtime error: Object doesn't support property or method 'val' 对于我的其中一页上具有autopostback = true的任何内容,我收到“ Microsoft JScript运行时错误:对象不支持此属性或方法”错误 - I get a “Microsoft JScript runtime error: Object doesn't support this property or method” error for anything with autopostback=true on one of my pages 运行时错误438。对象不支持此属性或方法 - Runtime error 438. Object doesn't support this property or method 0x800a01b6-JavaScript运行时错误:对象不支持属性或方法“ cookie” - 0x800a01b6 - JavaScript runtime error: Object doesn't support property or method 'cookie' JavaScript运行时错误:对象不支持jquery-ui.js中的属性或方法“替换” - JavaScript runtime error: Object doesn't support property or method 'replace' in jquery-ui.js 为什么 JavaScript 运行时错误:Object 不支持属性或方法 'datepicker' 发生?(datepicker 不是函数) - Why does JavaScript runtime error: Object doesn't support property or method 'datepicker' happen?(datepicker is not a function) 为什么 JavaScript 运行时错误:Object 不支持属性或方法 'getTime' 发生?(getTime 不是函数) - Why does JavaScript runtime error: Object doesn't support property or method 'getTime' happen?(getTime is not a function)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM