Get form data

2

How can I get data from all existing forms on a page? I have a form with the name "budgets" that I can send the fields but I have at least three more that are inserted via include and the fields of these forms I can not retrieve.

I would like to pass all fields regardless of the name.

Before I was doing this:

document.orcamentos.submit();

This sends all form data with the name "budgets", then trying to send all fields regardless of name I tried this:

$("form").submit();

But it sends the fields of the form "budget" and of the others inserted by include not.

            var sVazaoEta     = $("#Vazao_eta").val();
        var sTipoVazaoEta = $("input[name='TipoVazao_eta']:checked").val(); 
        var sFiltrosEta   = $("input[name='Filtros_eta']:checked").val();               

Is there any possibility of passing these variables to the detail page that is triggered by the form submit, since I'm using the:

$("form").submit(); 
    
asked by anonymous 25.06.2014 / 12:51

2 answers

3

You can use jQuery to serialize data from all forms and submit using $ .get or $ .post from jQuery

In this link you will have information on how to serialize 1 (one) form In this link you will have information on how to serialize the form in array format this is useful since you can add new elements to the array, in their case, the data of the other forms. You can serialize to an array the form budget and add in that array the data of all other forms. In this link you will have information on how to transform objects into parameters to be sent by get or post , if you have the need to add something else manually. In this link you will have information on how to submit data using the jQuery post In this link you will have information on how to submit data using jQuery get

    
25.06.2014 / 14:40
0

You can use the following javascript to send data from two or more forms:

<script language="javascript">
function() submitForms{
  document.getElementById("firstform").submit();
  document.getElementById("secondform").submit();
 }
</script>

<form id="firstform" target="iframe1">
</form><iframe name="iframe1" style="display:none"></iframe>
<form id="secondform" target="iframe2">
</form><iframe name="iframe1" style="display:none"></iframe>
<button onclick="submitForms()"><img src="images/order-button.png" "/></button>
    
25.06.2014 / 15:01