Run a bootbox.confirm inside an @Html.ActionLink

0

Good afternoon. I'm trying to use a modal for verification. (using the bootbox plugin). This is the js code.

var Confirmacao = {
            Mensagem: function () {
                bootbox.confirm({
                    message: 'Exemplo para teste',
                    buttons:
                        {
                            confirm:
                                {
                                    label: 'Yes',
                                    className: 'btn-success'
                                },
                            cancel:
                                {
                                    label: 'No',
                                    className: 'btn-danger'
                                }
                        },
                    callback: function (result) {

                        if (result) {
                            console.log("teste: " + result)
                            return result;
                        }
                    }
                });
            }
        };

In my view I'm setting up the link this way.

@Html.ActionLink("Efetivar",
                 "EfetivarRecurso",
                  new { idRecrutamento = item.IdRecrutamento, idRequisicao = item.IdRequisicao },
                  new { onclick = " return Confirmacao.Mensagem();" }
                        )

When I click on the link it flashes the modal on the screen and already executes the action. That is, it runs the javascript function and also runs href .

This is the HTML generated.

<a href="/Requisicao/SolicitacaoVaga/EfetivarRecurso?idRecrutamento=7&amp;idRequisicao=20" onclick=" return Confirmacao.Mensagem();">Efetivar</a>

My question is, is there any way that the link does not go into Action before I commit in the modal? Note: I'm doing this with this component as it is the default set by the team. Thanks in advance.

    
asked by anonymous 01.08.2018 / 18:29

0 answers