RequiredIfTrue not working client side for date fields

Jun 18, 2015 at 2:24 PM
Edited Jun 18, 2015 at 2:25 PM
I need to conditionally require a date field based on a boolean. This works fine server side but the date field is always required by the frontend validation.
[Required(ErrorMessage = "Please indicate if your name has ever changed")]
[Display(Name = "Has your name ever changed?")]
public bool nameChanged { get; set; }

[RequiredIfTrue("nameChanged", ErrorMessage = "Please enter your previous name")]
[Display(Name = "Previous Name")]
public string previousName { get; set; }

[RequiredIfTrue("nameChanged", ErrorMessage = "Please enter the date your name changed")]
[DisplayFormat(DataFormatString = "{0:dd/MM/yyyy}", ApplyFormatInEditMode = true)]
[Display(Name = "Date of Name Change")]
[DataType(DataType.Date)]
public string dateOfNameChange { get; set; }
The previousName field works as expected. Comparing the markup it seems that dateOfNameChange still has the data-val-required attribute with the default message, although it's not in the source:

Source:
<input class="text-box single-line" data-val="true" data-val-requiredif="Please enter the date your name changed" data-val-requiredif-dependentproperty="nameChanged" data-val-requiredif-dependentvalue="True" data-val-requiredif-operator="EqualTo" id="dateOfNameChange" name="dateOfNameChange" type="text" value="" />
Inspector:
<input class="text-box single-line" data-val="true" data-val-date="The field Date of Name Change must be a date." data-val-required="The Date of Name Change field is required." data-val-requiredif="Please enter the date your name changed" data-val-requiredif-dependentproperty="nameChanged" data-val-requiredif-dependentvalue="True" data-val-requiredif-operator="EqualTo" id="dateOfNameChange" name="dateOfNameChange" type="date" value="">
The scripts I'm loading are:
jquery-1.11.3.js
jquery.validate.js
jquery.validate.unobtrusive.js
mvcfoolproof.unobtrusive.js
Jun 18, 2015 at 2:41 PM
This appears to have fixed itself! Must have been cached or something, rebuilt and it worked.
Marked as answer by blues_driven on 6/18/2015 at 6:42 AM