HTML
  Home arrow HTML arrow Page 5 - 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 addRow() function


    (Page 5 of 6 )

    The addRow() function puts the form into the add-mode. It clears the text Input controls. It disables the following buttons: Edit, Delete, Find, and Sort. It increments the variable for the total number of rows. The new row will be added at the end of the recordset. So the total number of rows, including the one being added is equal to the new row’s position (last in recordset). These numbers (position and total) are displayed at the top-right area of the form. Lastly, the function frees the Input controls for typing.

    Note: it is not the addRow() function that adds the row to the recordset or the Transmitted Table. As I said above, clicking any of the enabled buttons triggers that.

    After you complete typing the row values in the form, you may wish to type in another row. This means that you have to click the Add button again. If you do this, it means the addRow() function has to complete the adding process by sending the data of the first added row on the form to the recordset and Transmission table. So before the addRow() function does anything, it first checks if you are to add another row (you have clicked the Add button again) just after adding a previous one. It does this by verifying whether the addMode variable is true. If it is, the function completes the Add process. In the completion process, it calls relevant functions and then resets the addMode variable to false.

    It is possible that you might come to the add-mode (i.e. click the Add button just after typing in information in the edit-mode). So the addRow() function, at the beginning, checks if the edit-mode variable is true. If it is, the function completes the Edit process and resets the editMode variable to true.

    After making the above two verifications, the addRow() function proceeds in its normal fashon. This is the code:


    function addRow()

    {

    //adding 2nd, 3rd or more times, i.e. addMode is already true

    if (addMode == true)

    {

    addRowToRecordset();

    //after adding, you must go out of the addMode, so reset the addMode variable

    addMode = false;

    makeReadOnlyInputControls();

    }

     

    //edit any row of the recordset that might have been edited at the form

    if (editMode == true)

    {

    editRowToRecordset();

    //after adding, you must go out of the editMode, so reset the editMode variable

    editMode = false;

    makeReadOnlyInputControls();

    //enable the buttons, Edit, Delete, Clear, Find, Sort.

    enableButtons('E1','D1','C1','F1','So1');

    }

     

    addMode = true;

    clearControls();


    //disable the buttons, Edit, Delete, Find and Sort

    disableButtons('E1','D1','F1','So1');

     

    //increment the total number of rows variable

    numberOfRows+=1;

     

    //show the data row number (position) and total number of rows

    document.getElementById('RowPosition').value = numberOfRows;

    document.getElementById('TNumberRows').value = numberOfRows;

     

    //make input controls write-able

    makeWriteInputControls();

    }


    More HTML Articles
    More By Chrysanthus Forcha


     

    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 6 hosted by Hostway
    Stay green...Green IT