2012-11-01 21 views
0

在頁面加載後... $(document).ready(function() { $("form").validate(); });無法看到控制背後的JQuery驗證消息驗證表單

上的保存按鈕單擊事件... if($('form').valid()) { Saving data here... }

「螢火蟲」與Chrome和Firefox顯示一切都只是完美$("form").validate()甚至$('form').valid()如預期的那樣返回true和false,但不能在特定的表單控件背後看到錯誤消息。

*全部都在MVC視圖

+1

wheres your code? –

+1

代碼位於cshtml文件中 – DOM

+0

進一步說明:我已將「必需」類手動添加到特定文本框和下拉列表。 – DOM

回答

0

賓果...按照我現在想要的方式工作。我剛剛刪除了「jqueryval」包(「jquery.validate.js」,「jquery.validate.unobtrusive.js」和「jquery.unobtrusive-ajax.js」),並且手動包含了「jquery.validate。 JS」。

現在一切都很好。

+0

結構化的方式:替換捆綁配置爲:bundles.Add(新的ScriptBundle(「〜/ bundles/jqueryval」)。Include(「〜/ Scripts/jquery.unobtrusive *」,「〜/ Scripts/jquery.validate * 「));'to'bundles.Add(new ScriptBundle(」〜/ bundles/jqueryval「).include(」〜/ Scripts/jquery.validate.js「));' – DOM