0

ASP.NETMVC3でモデル検証を使用しています。メールの比較検証はまったく実行されていません。MVC3用のDataAnnoatationsExtensionsもインストールしました。以下は私のコードです。

[Display(ResourceType = typeof(Resources.Views.Account.Local.Create), Name = "EMail1")]
[Required(ErrorMessageResourceType = typeof(Resources.Views.Account.Local.Create), 
    ErrorMessageResourceName = "rqEMail1")]
[RegularExpression(@"\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*", 
    ErrorMessageResourceType = typeof(Resources.Views.Account.Local.Create), 
    ErrorMessageResourceName = "regxEMail1")]

public string EMail1 { get; set; }


[Required]
[Compare("EMail1", ErrorMessageResourceType = typeof(Resources.Views.Account.Local.Create), 
    ErrorMessageResourceName = "cmpEmail")]
[RegularExpression(@"\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*", 
    ErrorMessageResourceType = typeof(Resources.Views.Account.Local.Create), 
    ErrorMessageResourceName = "regxEMail2")]

public string EMail2 { get; set; }
4

1 に答える 1

0

サーバー側で検証が正しく行われる場合は、クライアント側に含めたスクリプトを確認してください。これらのスクリプトは比較バリデーターと互換性がない可能性があります。特に、jQuery 自体と jQuery.Validate プラグインのバージョンを確認してください (最もよく使用されるクライアント側スクリプトを使用していると仮定します)。

于 2011-08-27T07:33:27.270 に答える