I have a table with many auto generated forms (there could literally be hundreds of forms). The code for that is php based and looks like this:
$cellPosition = 0;
$rowCounter = 1;
$infoCounter = 1;
for ($x=0;$x <= count($assetName);$x++)
{
for ($i=0;$i < count($currentJobs);$i++)
{
$rowCounter= 1;
if ($currentJobs[$i][0] == $table->getCellContents(0,$x))
{
for ($y =0; $y < $currentJobs[$i][10];$y++)
{
$rowCounter++;
}
$table->setCellAttributes ($rowCounter,$cellPosition,"id='jobCell' bgcolor = ". $currentJobs[$i][4]. " rowspan=" . $currentJobs[$i][9]);
$table->setCellContents($rowCounter++,$cellPosition,
"<form id='scheduleForm".$infoCounter++."' method='POST' action='../forms/updateJobForm.php'>".
"<input type='hidden' name='jobInfo' value='" . $currentJobs[$i][1] . "'/>" . " " . "Job# (".$currentJobs[$i][2] . ")<br>" . $currentJobs[$i][3] .
"</form>");
}
else
{
$rowCounter = 1;
}
}
$cellPosition++;
}
echo $table->display();
I have the jobCell (a td element) bound to the following javascript/jquery code:
<script>
$(document).ready(function()
{
$("#jobCell").click(function()
{
$(this).children('form').submit();
//$('#scheduleForm').submit();
});
});
</script>
I each jobcell is click-able and I previously had it to where clicking anyone would submit the form. The problem is that it would only send the information for the hidden information for the last jobcell in the table. Now with my current code, it only allows the user to click the first cell and it does submit. How accomplish submitting the hidden data in the jobcell that is clicked when I have many forms?