Reputation: 4072
I am creating a dynamic table (as seen above), but I do so by looping through my data object. Currently you fill out the data in the top section, then click stage, and the data is added to the table. I'd like to be able to update the data in the table as well.
This is how the table is built:
<?php
for($r = 0; $r < sizeof($dataArray); $r++){
for($i = 0; $i < $fields; $i++){
Echo "<td>
<input onchcange='updateData("WHAT GOES HERE?", ".$r.", ".$i.")' value='".$dataArray[$r][$i]."'>
</td>";
}
}
?>
updateData()
should take 3 parameters: the ROW, the COLUMN, and the new VALUE.
How can I select the new value from the input?
Upvotes: 0
Views: 51
Reputation: 9093
Pass the input element, or it's value, to the callback:
<input onchange='updateData(this.value, ".$r.", ".$i.")' value='".$dataArray[$r][$i]."'>
Generally, this
in an event handler context points to the element the handler is defined on.
Upvotes: 1