Building Single Row Database Forms with HTML - Sending Changes to Server Database
(Page 2 of 5 )
A normal HTML FORM element has a Submit button to send the name/value pairs of the form to the server. These name/value pairs would form a row in a database table at the server. You can arrange your database program to have that also. In other words, each time you process a row, you send it to the server. The disadvantage of this method is that you will have to wait for a row to be transmitted to the server and then wait for the next row you want to work with, which is transmitted from the server to you. In this series, I only consider the case where you process a number of rows and then send the processed rows to the server.
You only send the processed rows to the server. You do not have to send all the rows of the recordset to the server. Doing this would simply be a waste of time since the non-processed rows of the client are already at the server. To achieve this, we use another table with the style property, display:none. I call this table the Transmitted Table. For any row that you process (add, edit, or delete) at the recordset, a copy is made in the Transmitted Table. It is these copies that are sent to the server. The last cell of each row in the Transmitted Table indicates whether the row is a new (added) row to the recordset, an edited row, or a deleted row. These row copies are sent to a program-file at the server. The program-file uses the indications to affect the database as required. The Transmitted Table initially has no rows.
The HTML FORM element of our form only needs this Transmitted Table, the Save button, and the Done button as its content. The Save and Done buttons are submit buttons. The HTML FORM element is a block-level element. Looking at the positions of the button in the above figure, you should realize that it is not easy to just have the Transmitted Table and the Save and Done buttons in the HTML FORM element according to the Normal Flow in HTML design. So in our HTML FORM element, the Sort and navigation buttons are included. The program-file at the server will simply ignore any name/value pairs of the Sort and Navigation buttons.
Next: The Form Code >>
More HTML Articles
More By Chrysanthus Forcha