VallidationSummary shows no error on the screen

3

I am using ValidationSummary in forms, but they are not being rendered. Is there any known reason for this error?

Example form:

@using (Html.BeginForm("CadastrarPessoaFisica", "Usuario", FormMethod.Post))
{
    @Html.ValidationSummary(false)
    <div class="col-md-6 column">
        <div class="input-group">
            <span class="input-group-addon"><i class="glyphicon glyphicon-user"></i></span>
            @Html.TextBoxFor(e => e.Nome, new { @class = "form-control input-sm", placeholder = "Nome" })
        </div><br />

        <div class="input-group">
            <span class="input-group-addon">
                <i class="glyphicon glyphicon-envelope"></i>
            </span>
            @Html.TextBoxFor(e => e.Email, new { @class = "form-control input-sm", placeholder = "Email", type = "email" })
        </div><br />

        <div class="input-group">
            <span class="input-group-addon">
                <i class="glyphicon glyphicon-phone">
                </i>
            </span>
            @Html.TextBoxFor(e => e.Telefone, new { @class = "form-control input-sm", placeholder = "Telefone" })
        </div><br />

        <div class="input-group">
            <span class="input-group-addon">
                <i class="glyphicon glyphicon-phone">
                </i>
            </span>
            @Html.TextBoxFor(e => e.Celular, new { @class = "form-control input-sm", placeholder = "Celular" })
        </div><br />


        <div class="input-group">
            <span class="input-group-addon"><i class="glyphicon glyphicon-credit-card"></i></span>
            @Html.TextBoxFor(e => e.CPF, new { @class = "form-control input-sm", placeholder = "CPF" })
        </div>

        <br />
        <div class="input-group">
            <span class="input-group-addon"><i class="glyphicon glyphicon-lock"></i></span>
            @Html.TextBoxFor(e => e.Password, new { @class = "form-control input-sm", placeholder = "Senha" })
        </div>
        <br />
        <div class="input-group">
            <span class="input-group-addon"><i class="glyphicon glyphicon-home"></i></span>
            @Html.TextBoxFor(e => e.Endereco.CEP, new { @class = "form-control input-sm", placeholder = "Cep" })
        </div>
    </div>
    <div class="col-md-6 column">
        <div class="input-group">
            <span class="input-group-addon"><i class="glyphicon glyphicon-home"></i></span>
            @Html.TextBoxFor(e => e.Endereco.Rua, new { @class = "form-control input-sm", placeholder = "Rua" })
        </div>

        <br />
        <div class="input-group">
            <span class="input-group-addon"><i class="glyphicon glyphicon-home"></i></span>
            @Html.TextBoxFor(e => e.Endereco.Numero, new { @class = "form-control input-sm", placeholder = "Numero" })
        </div>

        <br />
        <div class="input-group">
            <span class="input-group-addon"><i class="glyphicon glyphicon-home"></i></span>
            @Html.TextBoxFor(e => e.Endereco.Complemento, new { @class = "form-control input-sm", placeholder = "Complemento" })
        </div>
        <br />
        <div class="input-group">
            <span class="input-group-addon"><i class="glyphicon glyphicon-home"></i></span>
            @Html.TextBoxFor(e => e.Endereco.Bairro, new { @class = "form-control input-sm", placeholder = "Bairro" })
        </div>


        <br />
        <div class="input-group">
            <span class="input-group-addon"><i class="glyphicon glyphicon-home"></i></span>
            @Html.TextBoxFor(e => e.Endereco.Cidade, new { @class = "form-control input-sm", placeholder = "Cidade" })
        </div>
        <br />
        <div class="input-group">
            <span class="input-group-addon"><i class="glyphicon glyphicon-home"></i></span>
            @Html.DropDownListFor(e => e.Endereco.Estado, ViewBag.Estado as IEnumerable<SelectListItem>, new { @class = "form-control" })
        </div>
        <br />
    </div>

    <div style="text-align:center;">
        <input type="checkbox" /> Eu concordo com os termos
    </div><br />

    <div class="col-md-12 responsive">
        <input type="submit" value="Registrar" class="btn btn-success btn-block">
    </div>
}
    
asked by anonymous 07.09.2014 / 22:32

1 answer

1

Possibly jQuery Unobstrusive Validation is missing. It is best to use the following NuGet package in your solution:

  

link

Add the JS scripts to the layout that should work.

    
07.09.2014 / 23:08