我需要对几个输入字段进行以下验证:
01 - Unicode String. No line breaks or tabs. DATA_MAX_LENGTH applies.
02 - Unicode Memo. Line breaks permitted. No tabs. DATA_MAX_LENGTH applies.
03 - Non-negative integer, as string.
04 - Non-negative Money (precision 18,2), as string.
05 - Date, as string, in the U.S. 4-digit-year format (e.g. 12/31/2012).
06 - Boolean (aka "Bit", "Yes/No"), as string, with "1" for True, "0" for False.
是否有提供所有这些验证(或可以扩展)的 Jquery 插件,或者使用多个插件是个好主意。我正在使用 MVC3,我需要它们用于表单上的动态控件。
我的模型问题(这些问题将为动态测验表单创建):
public class Question
{
public int QuestionID { get; set; }
public string QuestionText { get; set; }
public Nullable<bool> Required { get; set; }
public int DisplayOrder { get; set; }
public int StepID { get; set; }
public Nullable<int> DataType { get; set; } // validation relate here (1-6)
public Nullable<int> ControlType { get; set; }
public string Choices { get; set; }
public Nullable<int> MaxLength { get; set; }
}