Note that there are some explanatory texts on larger screens.

plurals
  1. POMVC3 Razor/JQuery Client side validation Not Works
    text
    copied!<p>I use ASP.NET MVC 3 Razor, with jquery validation plugin to build a Registration Form. So I included this:</p> <pre><code>&lt;script src="@Url.Content("~/Scripts/jquery-1.4.4.js")" type="text/javascript"&gt;&lt;/script&gt; &lt;script src="@Url.Content("~/Scripts/jquery.validate.js")" type="text/javascript"&gt; &lt;/script&gt; &lt;script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.js")" type="text/javascript"&gt;&lt;/script&gt; </code></pre> <p>I've added the following in my Web.config:</p> <pre><code>&lt;appSettings&gt; &lt;add key="ClientValidationEnabled" value="true" /&gt; &lt;add key="UnobtrusiveJavaScriptEnabled" value="true" /&gt; &lt;/appSettings&gt; </code></pre> <p>My Razor form looks like this:</p> <pre><code>@model bop.Web.Models.ProfileModel @{ Layout = "~/Views/Shared/_Layout.cshtml"; } &lt;h2&gt;Page title&lt;/h2&gt; @Html.ValidationSummary(true) @using (Html.BeginForm("Register", "Profile", FormMethod.Post, new { id = "RegForm" })) { &lt;fieldset&gt; &lt;div class="editor-label"&gt; @Html.LabelFor(model =&gt; model.companyName) &lt;/div&gt; &lt;div class="editor-field"&gt; @Html.EditorFor(model =&gt; model.companyName) @Html.ValidationMessageFor(model =&gt; model.companyName) &lt;/div&gt; &lt;div&gt; ... here other input fields ... &lt;/div&gt; &lt;a href="#" id="nextbtn1"&gt;GO TO STEP 2&lt;/a&gt; &lt;/fieldset&gt; </code></pre> <p>At the bottom I have:</p> <pre><code>&lt;script type="text/javascript"&gt; $(document).ready(function () { $('#nextbtn1').click(function () { // bind click event to link $("#RegForm").validate(); if ($("#RegForm").valid()) { var $tabs = $('#tabs').tabs(); // first tab selected $tabs.tabs('select', 1); // select second tab return false; } } } &lt;/script&gt; </code></pre> <p>I use bind on the click event because my registration form is splitted across 3 tabs, so I'll perform a submit in the third step.</p> <p>The problem is that when I click on "Go to step 2" button I get this error:</p> <pre><code>Run-time error in Microsoft JScript: Object does not support this property or method 'validate' </code></pre> <p>Much thanks in advance for helpful pointers.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload