I am able to validate all my fields individually in my form but as soon as i have to compare two field together, it's impossible for me to do it.
Let's say i wanna check if StartingDate is smaller than EndingDate , how is it possible for me to output an ErrorMEssage if it's not valid.
I tried with a Remote tag to call a function that check both datas but it's not working because only the field who call the function has data, it's weird.
Any idea ? Thanks a lot.
public class Hospitalisation
{
[DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:yyyy-MM-dd}")]
[DataType(DataType.Date)]
[Display(Name = "Starting Date")]
public string StartDate { get; set; } = string.Empty;
[DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:yyyy-MM-dd}")]
[DataType(DataType.Date)]
[Display(Name = "Ending Date")]
public string EndDate { get; set; } = string.Empty;
}