Open document from the same directory in new window after submitting

0

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

On the "protocol_menu" page we have created a form. The goal is that after giving the submit in the form open the page "voucher_protocol" in a new tab. The code for the protocol data to be registered 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'm trying to make sure that after submitting the "voucher_protocol.html" page open in a new tab, where a form will be presented with the data and other information to be delivered to the client and signed. I thought about putting the code like this:

'if (document.getElementById ("idprotocolo"). value == "") {             AddProtocol ();             window.open ......; '

It did not work and I did not find anything similar on the internet, does anyone have any idea how to do this?

    
asked by anonymous 22.04.2017 / 00:28

2 answers

1

Just put target="_ blank" in the form

<form target="_blank" ............
    
22.04.2017 / 18:07
0

I see two ways:

1 - post the content directly in the URL of the voucher, which in this case will be responsible for inserting and then displaying the result, using the target _blank in the form, as said colleague Leo Caracciolo;

2 - post the content in the script that will insert it and then redirect it to the voucher, re-submitting the information to fill in the voucher (disadvantage: information will be processed twice)

    
23.04.2017 / 15:26