'ColdFusion: multiple form submit at once on a single page

On a page, I have a ColdFusion loop that generate multiple forms and I want to submit them all. However, I realized only the first form is submitted since page reload afterward. Is there a way to submit them all?

    <cfloop index="i" from="1" to="#form.found#" >
      <cfif structKeyExists(form, "radioButton#i#")>
        <cfset selectedItem = #form["radioButton" & i ]#>
        <cfform id="createForm" name="createForm" method="post" action="/build/create_action.cfm">
          <input type="hidden" name="selectedItem" value="#selectedItem#"> 
        </cfform>
        
        <script>
          document.createForm.submit();
        </script>
      </cfif>
    </cfloop>

CreateForm will call the create_action process that will act on the selectedItem and eventually insert the result into the database. So I want to loop through all selectedItem and call the create_action process on each one of them.

Currently oldCreateForm takes in one selectedItem, passes it to create_action and processes it. I would like to change it so I can select multiple items, click submit and have create_action process all of them without changing create_action.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source