Home arrow HTML arrow Page 2 - Tabular Database Forms with HTML
HTML

Tabular Database Forms with HTML


In this eighth part to a thirteen-part series on HTML database forms, you will learn what a tabular form is, how to lay it out, and what functions you should use with it. Join us as we continue our journey.

Author Info:
By: Chrysanthus Forcha
Rating: 4 stars4 stars4 stars4 stars4 stars / 3
August 27, 2008
TABLE OF CONTENTS:
  1. · Tabular Database Forms with HTML
  2. · The Layout
  3. · The Layout continued
  4. · The addRow() Function

print this article
SEARCH DEVARTICLES

TOOLS YOU CAN USE

advertisement
Tabular Database Forms with HTML - The Layout
(Page 2 of 4 )

With our tabular form, the recordset, which is the data the user sees, is housed in a DIV element. You need to give the DIV element definite width and height dimensions. We give the DIV element the CSS overflow property of "overflow:scroll." With this property, the DIV element acquires the vertical and horizontal scroll bars. You can use these bars to scroll through the recordset.

There are three tables in the DIV element. The first table displays the titles for the recordset columns. The second table is the recordset. The third table displays the buttons (Add, Edit etc.). You have to make sure that the columns of the first and second tables are aligned. You have to choose the dimensions of the three tables so that they fit well in the DIV element.

As you can see from the above figure, there are no navigation buttons. We do not need them here. We have the scroll bars for that. So the lines for the navigation buttons and their JavaScript functions are removed from the code.

Recall that for the Single-Row Form the CSS display property for the recordset table is "display:none." Here we do not need that property. The default behavior of an HTML table is to be displayed as a block level element and to occupy space. Our recordset in the DIV element does not have that property.

Now that we have a table as the recordset, which is seen by the user, how can he edit data? For the Single-Row Form, data was entered in Input Text Controls. There were only six Input Text Controls corresponding to the six visible columns. Data was sent from the controls to a row in the recordset and back.

The solution here is to have one Input Text Control for each cell in the recordset. You set all their read-only property to "true." When the user wants to edit a row, you set the read-only property for all the Input Text Controls for that row to "false."

I will address the case when data is an image later. In this and the next part of the series I will talk only about small text data.

If you allow the default values for cellspacing and cellpadding for the recordset table, the gaps between the Input Text Control data will be rather wide. To make the gaps look conventional, set the cellspacing and cellpadding attributes to zero.

For the Single-Row Form we had to indicate the record position and the total number of rows. Here we can see the rows or simply scroll to see what is not visible. The size of the gray box of the vertical scroll bar indicates how long the recordset is. So we do not really need to indicate the row position and the total number of rows. For the sake of design simplicity we remove this feature and its corresponding code.

If your recordset is sorted, then you can easily scroll up or down to see a particular record. So we do not really need the Find function. For the sake of design simplicity we remove this feature and its corresponding code.

In the web page here, there is a main table for the page layout. Our DIV element is in a cell of this table. This is the content of the body element for the web page:

<body onload="start()">

<table>

<tbody>

<tr>

<td width="150">


</td>

<td>

<br /><br /><br /><br />

<table id="CT1">

<tr>

<table width="420">

<COLGROUP>

<col span="6" width="70">

</COLGROUP>

<tr><th>ID</th><th>Name</th><th>Dep't</th><th>Job</th><th>Years</th>
<th>Salary ($)</th></tr>

</table>

</tr>

<tr>

<td>

<div id="Tabular1">

<!-- The Recordset -->

<table cellspacing="0" cellpadding="0" id="Recordset">

<tbody>

<COLGROUP>

<col span="6" width="70">

<col id="Co6">

</COLGROUP>


blog comments powered by Disqus
HTML ARTICLES

- HTML5 Boilerplate: Working with jQuery and M...
- HTML5 Boilerplate Introduction
- New API Platform for HTML5
- BBC Adopts HTML 5, Mozilla Addresses Issues
- Advanced Sticky Footers in HTML and CSS
- HTML and CSS Sticky Footers
- Strategy Analytics Predicts HTML5 Phones to ...
- HTML5 Guidelines for Web Developers
- Learning HTML5 Game Programming
- More Engaging CSS3 and HTML Background Effec...
- Engaging HTML and CSS3 Background Effects
- More Web Columns with CSS3 and HTML
- Columns with CSS3 and HTML
- Creating Inline-Block HTML Elements with CSS
- Drag and Drop in HTML5: Parsing Local Files

Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 



© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 8 - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials