Vallidationsummary shows no error on screen

Asked

Viewed 237 times

3

I am using Validationsummary in Forms, but these are not being rendered. Is there any known reason for this error?

Form example:

@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>
}
  • You can put an example of Form?

  • Gypsy, I updated the question. I tried with true/false in Validationsummary, but was unsuccessful...

  • You included the scripts in the layout jquery.validate.js and jquery.validate.unobtrusive.js?

  • Gypsy, the Asp.net project by default does not have these scripts. For knowledge, I started a Webapi 2 project... ?

  • Yes, in the presentation layer, otherwise it doesn’t work.

  • I’ll add these scripts...

  • Gypsy, suggest some specific nuget package for these scripts? I am using bootstrap...

Show 2 more comments

1 answer

1


Browser other questions tagged

You are not signed in. Login or sign up in order to post.