title: Require field if checkbox is checked
body: <p>I have a field in a form that I need to be required if a checkbox in the same form is checked.</p>
  
  <p>There doesn't seem to be a way to do this with regular model validation, so I created a remote validation method in my controller.</p>
  
  <p>The problem is, since the field isn't required always, the validation doesn't even fire if I put it on the field.  So I tried putting the validation on the checkbox, and now I get a different problem where the validation doesn't fire when I add text to the field.</p>
  
  <p>Is there a way to do what I'm needing with custom validation, or do I need to do something in JavaScript?  If so, what do I need to do?</p>
  
  <p><strong>Form:</strong></p>
  
  <pre><code>&lt;form&gt;
     &lt;input type="checkbox" asp-for="NotRecommended" checked=@Model.NotRecommended /&gt; &lt;label&gt;Not Recommended&lt;/label&gt;
     &lt;textarea class="form-control" id="Notes" asp-for="Notes"&gt;&lt;/textarea&gt;
     &lt;span asp-validation-for="NotRecommended" class="text-danger"&gt;&lt;/span&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p><strong>Model:</strong></p>
  
  <pre><code>public class DetailsViewModel
  {
      [DisplayName("Not Recommended")]
      [Remote("RequireNoteForFlag", AdditionalFields = "Notes", ErrorMessage = "Note is required when flagging someone.")]
      public bool NotRecommended { get; set; }
  
      [DataType(DataType.MultilineText)]
      [MaxLength(1500)]
      [DisplayName("Notes")]
      public string Notes { get; set; }
  }
  </code></pre>
  
  <p><strong>Remote Validator</strong></p>
  
  <pre><code>public IActionResult RequireNoteForFlag(bool NotRecommended, string Notes)
  {
      if (NotRecommended &amp;&amp; String.IsNullOrWhiteSpace(Notes)) return Json("Note is required when flagging an Assessor");
      else return Json(true);
  }
  </code></pre>