I need to validate input field based on a property that is within the same model, however is not being used in the DOM. Something like so:
[RequiredIf("NameRequired", ErrorMessage = "Name is required")]
public string Name {get;set;}
public bool NameRequired {get;set} = true;
DOM:
@HTML.TextBoxFor(model=>model.Name);
NameRequired by default is true however it can be changed in other places of the code, which is why it is needed, however when running this code expressiveannotations complains that NameRequired
field is not found in the DOM