1
I have a form with several fields that are mandatory. By clicking submit, validation is performed using jquery validation and being ok, send to the controller (ASP.Net MVC).
I need that after the form validation, display a modal with a contract (PDF file) and if the user accepts, call the controller.. Negative case, prevents Submit.
[Edit] I will post down what I already have
//Model
public class Usuario
{
[Required(ErrorMessage = "O produto é obrigatório!")]
public int CodigoProduto { get; set; }
[Required(ErrorMessage = "O email é obrigatório!")]
[RegularExpression(@"^[\w-]+(\.[\w-]+)*@([a-z0-9-]+(\.[a-z0-9-]+)*?\.[a-z]{2,6}|(\d{1,3}\.){3}\d{1,3})(:\d{4})?$", ErrorMessage = "Digite um email válido!")]
public string Email { get; set; }
.
.
.
}
//View
<section class="section_formulario">
<div class="container">
<div class="seta-lateral hidden-xs"></div>
@using (Html.BeginForm("Cadastro", "Home", FormMethod.Post, new { id = "formEntry" }))
{
@Html.AntiForgeryToken()
@Html.ValidationSummary(true, "", new { @class = "text-danger" })
<div class="row">
<div class="col col-12">
<p>
<label>Produto</label>
@Html.DropDownListFor(model => model.CodigoProduto, ViewBag.ProdutoId as IEnumerable<SelectListItem>, "Selecione", new { @class = "form-control validate" })
@Html.ValidationMessageFor(model => model.CodigoProduto, "", new { @class = "text-danger" })
</p>
</div>
<!-- /.col -->
<div class="col col-lg-12">
<p>
<label>E-mail</label>
Informe seu e-mail principal.
@Html.EditorFor(model => model.Email, new { htmlAttributes = new { @class = "form-control validate" } })
@Html.ValidationMessageFor(model => model.Email, "", new { @class = "text-danger" })
</p>
</div>
<!-- /.col -->
</div>
<div class="separator separator-20"></div>
<div class="row">
<div class="col col-lg-12">
<input type="submit" id="modalContrato" name="salvar" class="btn btn-primary" value="Salvar" />
</div>
<!-- /.col -->
</div>
}
</div>
</section>
<div class="modal" id="modal-alerta">
<div class="modal-dialog">
<div class="modal-content">
<!-- Cabeçalho do Modal -->
<div class="modal-header">
<h2>Contrato de Serviço</h2>
</div>
<!-- Corpo do Modal -->
<div class="modal-body">
<p>Conteúdo do contrato</p>
</div>
<!-- Rodapé do Modal -->
<div class="modal-footer">
<button class="btn btn-danger" data-dismiss="modal">Cancelar</button>
<button class="btn btn-success">Aceitar</button>
</div>
</div>
</div>
</div>
<script type="text/javascript">
$(document).ready(function () {
$("#modalContrato").click(function () {
$("#modal-alerta").modal();
});
});
</script>
What have you done? Can the code, so it is easier to know the path you are following.
– Netinho Santos
I edited the original question with what I already have. Thank you.
– Daniel Afonso