0
Possible, within one click the call of two Ubmit?
Here’s my problem, I need inside a button, to be called two Actionresult in sequence.
Follow what I’ve done so far:
$('#enviarPreProposta').click(function () {
var telefoneValido = ValidarTelefones();
var idUltimoTelefone = $('#tblTelefones tbody tr:last td:first input').val();
if (idUltimoTelefone == undefined) {
MessageBoxKo('É obrigatório a inclusão de pelo menos um telefone.', 'Atenção', null, null, null, null);
return false;
}
var retorno = ValidarCamposNecessarios();
if (retorno == true && telefoneValido) {
DesabilitarCamposResposanvelFinanceiro();
$('#frmVendaEletronica').attr('action', '../VendaAdministrativa/ValidarCampos')
$('#frmVendaEletronica').submit();
$('#frmVendaEletronica').attr('action', '../VendaAdministrativa/EnviarPrePropostaAceitacao')
$('#frmVendaEletronica').submit();
}
});
At each request the page is regarregada, therefore it is not possible and not very logical to make two "submits", because in the first Ubmit the page already loads. But there is a solution, Ajax, however you will have to modify the back-end interface to be able to get the answer, using a more ajax-friendly format like Json for example. Yet instead of ajax maybe it’s better you create a single route where all back-end events occur instead of having two routes.
– Guilherme Nascimento
You can put a
return RedirectToAction()
in an action or work with Viewmodels for it. Post what you need to do that will be easier to help you.– Randrade
@Randrade, then my dear, the problem is : I have an actionResult that returns to the screen a Dialog, and I can only follow with the system flow, if the user fills or closes this dialog, in sequence, the application calls another actionResult.
– AbnoanMuniz
If you add how you are returning this dialog and this comment information in the question, it will be easier to help you. Explain what you really need to do.
– Randrade