title: Validate Input AspNetMvc
body: <p>How do I validate the Exit of an Input, already have the function that returns bool, if returning false, is not allowed to exit the input seller.sname, and present an alert message.</p>
  
  <pre><code>&lt;div class="row"&gt;
  &lt;div class="col-md-4"&gt;
      &lt;form asp-action="Update"&gt;
          &lt;input type="hidden" asp-for="seller.sellerid" /&gt;
          &lt;div class="form-group"&gt;
              &lt;label for="name"&gt;Name:&lt;/label&gt;
              &lt;input asp-for="seller.name" class="form-control" /&gt;
          &lt;/div&gt;
          &lt;div class="form-group"&gt;
              &lt;label for="email"&gt;EMail:&lt;/label&gt;
              &lt;input asp-for="seller.email" class="form-control" /&gt;
          &lt;/div&gt;
          &lt;div class="form-group"&gt;
              &lt;label for="birthdate"&gt;Birth Date:&lt;/label&gt;
              &lt;input asp-for="seller.birthdate" class="form-control" /&gt;
          &lt;/div&gt;
          &lt;div class="form-group"&gt;
              &lt;label for="basesalary"&gt;Base Salary:&lt;/label&gt;
              &lt;input asp-for="seller.basesalary" class="form-control" /&gt;
          &lt;/div&gt;
          &lt;div class="form-group"&gt;
              &lt;label for="departamentid"&gt;Departament:&lt;/label&gt;
              &lt;select asp-for="seller.departamentid" asp-items="@(new SelectList(Model.departaments, "departamentid", "name"));" class="form-control"&gt; &lt;/select&gt;
          &lt;/div&gt;
          &lt;div class="form-group"&gt;
              &lt;input type="submit" value="Save" class="btn btn-default" /&gt;
              &lt;a asp-action="Index"&gt;Back To List&lt;/a&gt;
          &lt;/div&gt;
      &lt;/form&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p></p>