簡體   English   中英

使用 JQuery 進行 MVC 表單驗證,對象問題

[英]MVC form validation with JQuery, problems with object

所以我想用 JQuery 驗證來驗證表單,但似乎 JQuery 不喜歡使用類。 這是我嘗試過的示例:

我的js:

$('#myForm').validate({
        rules: {
            something: {
                required:true
            },
            'name.first': { //Between qoutes, because JS does not want to run without
                required:true
            },
            'name.last': {
                required: true
            }
        }
    });

我的型號:

public class myModal
{
    string something { get; set; }
    public name name { get; set; }
}

public class name
{
    string first { get; set; }
    string last { get; set; }
}

提前致謝,漢諾

我很笨,忘了包含一個 JS 文件。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM