Open document from the same directory in new window after Submit

Asked

Viewed 159 times

0

In my directory I have the following pages in HTML: public_html // Index.html // proof_protocol.html // protocolo_menu.html

On the "protocolo_menu" page we set up a form. The goal is that after giving the Ubmit in the form open the page "comprovante_protocolo" in a new tab. The code for the protocol data to be recorded is:

function EditarCadastrarProtocolo() {
    if (document.getElementById("idProtocolo").value == "") {
        AdicionarProtocolo();
    } else {
        EditarProtocolo(document.getElementById("idProtocolo").value);
    }
}

function AdicionarProtocolo() {

    var cod = GerarIdProtocolo();
    $("#idProtocolo").val(cod);
    var select = document.getElementById("clienteProtocolo");
    var clienteSelecionado = select.options[select.selectedIndex].value;
    var protocolo = JSON.stringify({
        codigo: cod,
        data: $("#dataProtocolo").val(),
        codCliente: clienteSelecionado,
        observacoes: $("#observacoes").val()
    });
    tbProtocolos.push(protocolo);
    localStorage.setItem("tbProtocolos", JSON.stringify(tbProtocolos));
    alert("Protocolo " + cod + " Cadastrado com Sucesso!");
    ListarProtocolos();
}

I am trying to make that after Submit the "comprovante_protocol.html" page opens in a new tab, where a form will be presented with the registered data and other information to be delivered to the customer and signed. I thought I’d put the code like this:

' if (Document.getElementById("idProtocolo").value == "") { AdicionarProtocolo(); open window.......;'

It didn’t work out and I couldn’t find anything like it on the Internet, does anyone have any idea how to do it?

  • Most web users do not view pop-us since most browsers have a built-in mode for blocking. Will your popup not fall in this scenario?

2 answers

1

Just put target="_Blank" in the form

<form target="_blank" ............
  • I managed to put a code to open the document in a popup

  • Because then, here will not open your popup and believe that in many users also not.

0

I see two ways:

1- post the content directly to the URL of the voucher, in which case will be responsible for doing the Insert and then display the result, using the target _Blank in the fomulário, as said colleague Leo Caracciolo;

2- post the content in the script that will make the Insert and then redirect to the voucher, sending again the information to fill in the voucher (benefit: the information will be processed twice)

Browser other questions tagged

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