Maybe.
You can submit forms via javascript with the document.
formname.submit() function. So on the submit button would call a function that loops through all the forms on your page and submits them.
But if it's crucial behavior (like, the app will break if all forms don't submit simultaneously) then I wouldn't count on javascript because it's just too easy to turn it off at the browser level.
But... perhaps there's a different way of looking at the problem. Any submit button in a given form will cause that form to submit... so you could have more than one submit button.
So maybe:
Code:
<form action= "blah" method = "post">
<CFOUTPUT query="qryEmpInEvent">
<tr>
<td> #qryEmpInEvent.EmpName#</td>
<td> <input type="text" name="hours" </td>
<td> <input type="submit" value="Enter hours"</td>
</tr>
</CFOUTPUT>
</form>
is all you really need to do. Clicking
any of the submit buttons would submit the entire form, and
would contain a comma-delimited list of all the values entered in every hours field.
Of course... if all you get is a comma-delimited list of values, sometimes it's difficult to know which value goes with which record (in this case, employee).
A simple way around that is to name each field uniquely, based in part on some identifier for the employee in question.
Code:
<form action="blah" method="post">
<CFOUTPUT query="qryEmpInEvent">
<tr>
<td>#qryEmpInEvent.EmpName#</td>
<td>
<input type="text" name="hours_#qryEmpInEvent.EmpID#">
<input type="hidden" name="listIDs" value="#qryEmpInEvent.EmpID#">
</td>
<td><input type="submit" value="Enter hours"</td>
</tr>
</CFOUTPUT>
</form>
So, once the CFML has processed, the form looks something like this to the browser:
Code:
<form action="blah" method="post">
<tr>
<td>Joe Smith</td>
<td>
<input type="text" name="hours_1">
<input type="hidden" name="listIDs" value="1">
</td>
<td><input type="submit" value="Enter hours"</td>
</tr>
<tr>
<td>Jane Doe</td>
<td>
<input type="text" name="hours_2">
<input type="hidden" name="listIDs" value="2">
</td>
<td><input type="submit" value="Enter hours"</td>
</tr>
<tr>
<td>Jeff Black</td>
<td>
<input type="text" name="hours_3">
<input type="hidden" name="listIDs" value="3">
</td>
<td><input type="submit" value="Enter hours"</td>
</tr>
</form>
since all the hidden fields have the same name, in the action page
will contain a convenient list of IDs that you can loop over and dynamically pull the value of the similarly-named hours field:
Code:
<CFLOOP list="#FORM.listIDs#" index="whichID">
<CFSET fieldValue = FORM["hours_#whichID#"]>
<CFOUTPUT>Employee ID: #whichID# entered #fieldValue# hours</CFOUTPUT><br />
</CFLOOP>
-Carl