Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8348347
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T07:39:50+00:00 2026-06-09T07:39:50+00:00

I need to be able to have one submit button for multiple forms. I

  • 0

I need to be able to have one submit button for multiple forms. I only took two forms from my coding for the sake of simplicity. Each form has its own unique ID, but each form is very much identical to one another save a few discrepancies. My problem is only the first form is submitted successfully. I realize the reason for that is my input fields have the same name in each and every form so it will not recognize a duplicate input field currently. Is there a way that each field can be submitted successfully even though the input fields are the same, I hope that with help I will be able to submit both ‘input_1’ values and process it as ‘form1:input_1’ and ‘form2:input_1’ respectively.
Thank you very much in advance

     <body><form name="form1">
     <input type="hidden" name="formID" value="form2"/>
     <input type="hidden" name="redirect_to" value=""/>
     <INPUT TYPE=TEXT NAME="input_1" SIZE=10 />
     <INPUT TYPE=TEXT NAME="input_A" SIZE=15>/<INPUT TYPE=TEXT NAME="input_C"style="width: 1em" maxlength="1"><sup>s</sup>

     <INPUT TYPE=TEXT NAME="input_B" SIZE=10 />
     <INPUT TYPE="button" VALUE="+" name="SubtractButton" onkeydown="CalculateIMSUB(this.form)">
     <INPUT TYPE=TEXT NAME="Answer" SIZE=12>
     <input type="hidden" name="val" value="298" />
     <INPUT TYPE=TEXT NAME="Answer_2" SIZE=4></form>

     <form name="form2">
     <input type="hidden" name="formID" value="form2"/>
     <input type="hidden" name="redirect_to" value=""/>
     <INPUT TYPE=TEXT NAME="input_1" SIZE=10 />
     <INPUT TYPE=TEXT NAME="input_A" SIZE=15>/<INPUT TYPE=TEXT NAME="input_C"style="width: 1em" maxlength="1"><sup>s</sup>

     <INPUT TYPE=TEXT NAME="input_B" SIZE=10 />
     <INPUT TYPE="button" VALUE="+" name="SubtractButton" onkeydown="CalculateIMSUB(this.form)">
     <INPUT TYPE=TEXT NAME="Answer" SIZE=12>
     <input type="hidden" name="val" value="298" />
     <INPUT TYPE=TEXT NAME="Answer_2" SIZE=4></form>
     <input type="submit" name="Submit" id="button" value="Submit" onClick="submitAllDocumentForms()"></body>

Javascript code:

    <script language="javascript" type="text/javascript">
    /* Collect all forms in document to one and post it */
    function submitAllDocumentForms() {
    var arrDocForms = document.getElementsByTagName('form');
    var formCollector = document.createElement("form");
    with(formCollector)
    {
    method = "post";
    action = "process.php";
    name = "formCollector";
    id = "formCollector";
    }
    for(var ix=0;ix<arrDocForms.length;ix++) {
    appendFormVals2Form(arrDocForms[ix], formCollector);
    }
    document.body.appendChild(formCollector);
    formCollector.submit();

    }
    /* Function: add all elements from ``frmCollectFrom´´ and append them to ``frmCollector´´ before returning ``frmCollector´´*/
    function appendFormVals2Form(frmCollectFrom, frmCollector) {
    var frm = frmCollectFrom.elements; 
    var nElems = frm.length;
    for(var ix = nElems - 1; ix >= 0 ; ix--)
    frmCollector.appendChild(frm[ix]);
    return frmCollector;
    }
    </script>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T07:39:53+00:00Added an answer on June 9, 2026 at 7:39 am

    name is not a standard attribute for the form tag. I suggest that you use id for identiying your forms.

    I have not tested the below changes, but I expect them to work:

    function appendFormVals2Form(frmCollectFrom, frmCollector) {
        var currentEl;
        var frm = frmCollectFrom.elements; 
        var nElems = frm.length;
        for(var ix = nElems - 1; ix >= 0 ; ix--) {
            currentEl = frm[ix];
            currentEl.name = frmCollectFrom.name + ':' + currentEl.name;
            frmCollector.appendChild(currentEl);
        }
        return frmCollector;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a website where users submit questions (zero, one or multiple per day),
With the help of Nick Craver, I am now able to have two forms
I need to be able to have a SelectionBoxItemTemplate for my ComboBox, but am
I need to be able to have an SQL query that searches my database
In the ASP.Net application I am writing I need to be able to have
Consider this page @ http://www.bloodbone.ws/screwed.html I need to be able to have the a.grow
I have this script and need to be able to call the $play variable
I need to be able to manually trigger a mouse click and have that
I need to be able to display data that I have in 15 minute
I have many PowerPoint presentations that I need to be able to add to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.