2017-04-19 10 views
0

次の表現型アノテーションで作成された日付フィールドにJQueryUI datepickerウィジェットを使用すると、他のフィールドをクリックして日付に戻るまでクライアント側の検証は行われません日付フィールドを終了します。ExpressiveAnnotationsとJqueryUI DatePickerがクライアント側の検証を起動しない

[AssertThat("ResolutionDate<=Today()", ErrorMessage = "Resolution date can not be in the future.")] 
[AssertThat("ResolutionDate>=DateReceived", ErrorMessage = "Resolution date must be after the date received.")] 
[DataType(DataType.Date)] 
public DateTime? ResolutionDate { get; set; } 

私は何らかのイベントが見逃されていると仮定しています。任意のアイデアや修正?

答えて

1

解決策は、日付ピッカーウィジェットのonSelectイベントでフィールドの検証を強制することでした。

$("#ResolutionDate").datepicker({ 
    showAnim: "slide", 
    maxDate: "0", 
    onSelect: function() { 
     $(this).valid(); 
    } 
}); 
関連する問題