Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

269
Vistas
How can I check if the form is validated successfully by Html.ValidationSummary

I am using Html.BeginForm to submit my form and Html.ValidationSummary for validating. Now I would like to do an action in javascript (launch a reload animation) only if the form is submitted succesfully. My problem is, that the action is fired even when the form of the validation is is not validated successfully. Is it possible to find out if the validation was successful or not?

Here is my code:

@using (Html.BeginForm("AddRequest", "Manage", FormMethod.Post, new { id="addRequest"}))
{
<div class="modal-body">
    <div>@Html.ValidationSummary(false, "", new { id = "requestValidationSummary" @*onsubmit = "return viewNewRequestLoader()"*@ })</div>
    <div class="form-horizontal">
        <div class="form-group">
            @Html.LabelFor(m => m.DateFrom, "Datum od:", new { id = "labelReqDateFrom" })
            @Html.TextBoxFor(m => m.DateFrom, new { @class = "date-picker form-control", Value = "", type = "date", id = "requestDateFrom" })
            @Html.LabelFor(m => m.DateTo, "Datum do:", new { id = "labelReqDateTo" })
            @Html.TextBoxFor(m => m.DateTo, new { @class = "date-picker form-control", Value = "", type = "date", id = "requestDateTo" })
            @Html.LabelFor(m => m.Description, "Popis:")
            @Html.TextBoxFor(m => m.Description, new { @class = "form-control", Value = "", Id = "RequestDescription" })
        </div>
    </div>
</div>
<div class="modal-footer">
    <button type="button" class="btn btn-light" data-dismiss="modal">Zavřít</button>
    <button type="submit" class="btn btn-primary">Potvrdit</button>
</div>
}

and js code:

$("#addRequest").submit(function (event) {
        $('.modal').modal('hide');
        $("#ajaxLoader").fadeIn(300);
    });
about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda