-5
@model Projeto1.Models.Cliente
@{
ViewBag.Title = "Create";
}
<h2>Criar Novo Cliente</h2>
@using (Html.BeginForm())
{
@Html.AntiForgeryToken()
<div class="form-horizontal">
<hr />
@Html.ValidationSummary(true, "", new { @class = "text-danger" })
<div class="form-group">
@Html.LabelFor(model => model.Nome, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.Nome, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.Nome, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.CPF, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10" id="CPF" name="CPF">
@Html.EditorFor(model => model.CPF, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.CPF, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.Endereco, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.Endereco, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.Endereco, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group" id="TELEFONE">
@Html.LabelFor(model => model.Telefone, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.Telefone, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.Telefone, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group" id="CELULAR">
@Html.LabelFor(model => model.Celular, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.Celular, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.Celular, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.Email, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.Email, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.Email, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.Sexo, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.Sexo, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.Sexo, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.EstadoCivil, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.EstadoCivil, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.EstadoCivil, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.Salario, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.Salario, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.Salario, "", new { @class = "text-danger" })
</div>
</div>
@*<div class="form-group">
@Html.LabelFor(model => model.DataCadastro, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.DataCadastro, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.DataCadastro, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.DataAlteracao, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.DataAlteracao, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.DataAlteracao, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.DataExcluido, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.DataExcluido, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.DataExcluido, "", new { @class = "text-danger" })
</div>
</div>*@
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<input type="submit" value="Criar Novo Cliente" class="btn btn-default" />
</div>
</div>
</div>
<div>
@Html.ActionLink("Ver lista de clientes", "Index")
</div>
@section Scripts {
@Scripts.Render("~/bundles/jqueryval")
@Scripts.Render("~bundles/inputmask")
}
<script type="text/javascript">
$(document).ready(function () {
$("#CPF").mask("999.999.999-99");
});
</script>
}
In the code you shared here only has a mask in the CPF field, if you have any validation in the backend you have not shared. You need to improve your question a lot.
– George Wurthmann
What’s the problem? submit a [MCVE]
– Leandro Angelo