HTML
  Home arrow HTML arrow Page 6 - More Database Form Functions with HTML
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
HTML

More Database Form Functions with HTML
By: Chrysanthus Forcha
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 3 stars3 stars3 stars3 stars3 stars / 4
    2008-07-30

    Table of Contents:
  • More Database Form Functions with HTML
  • The showPreviousRow() Function
  • The showLastRow() Function
  • The showFirstRow() Function
  • The addRow() function
  • The addRowToRecordset() Function

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    More Database Form Functions with HTML - The addRowToRecordset() Function


    (Page 6 of 6 )

    The addRowToRecordset() function adds a row with the information in the form Input controls to the end of the recordset. It also calls the includeInTransmittedTable('ADDED') function. This function adds the copy of the row added to the recordset to the Transmitted Table. The argument “ADDED” is the value for the last field in the row (copy) of the Transmitted Table.

    Remember that if the form starts with an empty recordset, all the navigation buttons are disabled. In this case, while you are adding rows to the recordset, you enable the Show-First and Show-Previous buttons, so that you can navigate back to the rows you have added. So when the number of rows added to the recordset reaches 2, the addRowToRecordset() function enables these buttons.

    To understand the details of the addRowToRecordset() function, you need to have basic knowledge in HTML DOM Table object, HTML DOM Row object, and HTML DOM Table Cell object. This is the code of the function:


    function addRowToRecordset()

    {

    //the row is added at the end of the recordset - you can sort afterwards

    //insert a blank row at the end of the table

    document.getElementById('Recordset').insertRow(numberOfRows - 1);

     

    //form the ID of the new row

    rowID = 'TR' + (numberOfRows-1);

    //give the new row its ID

    document.getElementById('Recordset').rows[numberOfRows - 1].id = rowID;

     

    //insert blank cells, give them IDs and their contents

    for (j=0;j<6;j++)

    {

    //form ID for table cell

    RID = "TD" + (numberOfRows - 1) + j;

     

    //form the input text control ID

    ID = "EI" + j;

     

    document.getElementById('Recordset').rows[numberOfRows - 1].insertCell(j);

    document.getElementById('Recordset').rows[numberOfRows - 1].cells[j].id = RID;

    document.getElementById('Recordset').rows[numberOfRows - 1].cells[j].innerHTML = document.getElementById(ID).value;

    }

     

    //add the seventh blank cell with the value, -1, which shows that the row has not been edited

    document.getElementById('Recordset').rows[numberOfRows - 1].insertCell(6);

    document.getElementById('Recordset').rows[numberOfRows - 1].cells[6].innerHTML = "-1";

     

    includeInTransmittedTable('ADDED');

     

    //If numberOfRows is 2, enable showFirstRow and showPreviousRow Buttons since they are still disabled.

    if (numberOfRows == 2)

    {

    enableButtons('SFA1','SP1');

    index = 1; //this will be used in setting the row position number

    }

    }


    We continue in the next part of the series.


    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

     

    HTML ARTICLES

    - Using a 3D HTML Table as a Recordset
    - Building a 3D HTML Table
    - Maximizing and Restoring HTML Images: Layer ...
    - Completing Construction of a Database Form w...
    - Maximizing and Restoring Images in a Tabular...
    - Building the Recordset for an HTML Database ...
    - Laying Out a Database Form with HTML
    - Tabular Database Form Functions with HTML
    - Tabular Database Forms with HTML
    - Using the Find Functions for HTML Database F...
    - Sorting for Database Forms with HTML
    - Edit and Other Database Form Functions with ...
    - More Database Form Functions with HTML
    - Database Form Functions with HTML
    - Using the HTML Table Element as a Recordset






    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
    Stay green...Green IT