Send information without completing the form (submit)

0

I have a form in html and I need to fill in the fields and click the "Next" button to send the form by email without the person noticing, since the form continues in the next steps ...

<div class="form-group">
  <input id="texto nomeform1" minlength="5" type="text" class="form-control" name="nome" placeholder="Nome Completo*">
</div>

<div class="form-group">
  <input id="texto" type="email" class="form-control" name="email" placeholder="Email Válido*">
</div>

<div class="form-group">
  <input type="text" class="form-control" id="celular" name="celular" placeholder="Telefone">
</div>

<div class="form-group">
  <input type="text" class="form-control" name="sobre" placeholder="Como ficou sabendo sobre festas?">
 </div>
                            
<button type="button" name="usrSubmit" class="next action-button enviar_email" id="proximo" disabled value="Próximo"> Próximo</button>       

Currently I can already send the information I want to email, but it ends the form ...

    
asked by anonymous 10.05.2018 / 22:18

1 answer

0

Hello @Jvs Corrêa,

Let's assume that you already have Ajax implemented, if you do not need to add code like this:

$("#form1 .next").click(function(){


    var form = $(this);
        var formdata = false;
        if (window.FormData){
            formdata = new FormData(form[0]);
        }

        var formAction = form.attr('action');
        $.ajax({
            url         : "form-folder/salvar.php",
            data        : formdata ? formdata : form.serialize(),
            cache       : false,
            contentType : false,
            processData : false,
            type        : 'GET',            
            success     : function(data, textStatus, jqXHR){

                // Callback code

                //alert(data);

                //$(".temp_message").html(data);


            }
        });

        return false

});//end click  

In this way, when you click on btn '.next', it will send the data via GET with Ajax to the file that you manage the data, sending them by email. In this scenario, at each next, a new email will be sent, without reloading the page.

  • If you want the email to be sent only at the end of all the next's, ie fill in step1, click next, step2 > next and when it arrives at the last one there then the sending occurs, then some more items need to be implemented. It can be with the layout dynamics itself, creating a tab engine, where it runs hide () and show () according to the next one, or working with sessions.
17.05.2018 / 13:42