Edit and Other Database Form Functions with HTML - The deleteRow() Function
(Page 2 of 4 )
This function can be as complicated as you want, but I will make it very simple. The data you are currently seeing on the form is the one whose corresponding row in the recordset will be deleted.
You can click the Delete button whenever it is enabled. When you click it, the deleteRow() function is called. It first calls the “includeInTransmittedTable('DELETED')” function. The includeInTransmittedTable() function makes a copy of the row to be deleted in the Transmitted Table. The value “DELETED” is passed. As I said, this value will be the last piece of data in the copied row of the Transmitted Table. At the server, the program-file that receives the processed rows will use this data to know that this was a deleted row.
The function then goes on to write the word “DELETED” in all the fields of the corresponding row in the recordset, except the last field where the value remains –1. The function also writes the word “DELETED” in all the Input controls of the form. The data on the form corresponds to a particular row in the recordset. The position of this row is always indicated at the top-right area of the form. The is the code for the deleteRow() function:
function deleteRow()
{
//add the row to be deleted with its indication to the Transmitted Table.
includeInTransmittedTable('DELETED');
//replace the first six fields of the recordset row and all control fields with the word, DELETED
for (j=0;j<6;j++)
{
//form the input text control ID
ID = "EI" + j;
//form the input text control ID
CID = "EI" + j;
document.getElementById('Recordset').rows[index].cells[j].innerHTML = "DELETED";
document.getElementById(CID).value = "DELETED";
}
}
Next: The includeInTransmittedTable(Decision) Function >>
More HTML Articles
More By Chrysanthus Forcha