HTML
  Home arrow HTML arrow Page 3 - 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

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

    Table of Contents:
  • Database Form Functions with HTML
  • Text Input Controls Operation
  • The Edit Operation
  • The Code

  • 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


    Database Form Functions with HTML - The Edit Operation


    (Page 3 of 4 )

    When you click the Edit button, to set the form into the edit-mode, the text input controls are freed for you to type. The Edit, Delete, Clear, Find and Sort buttons are disabled. It does not make sense for you to delete, find or sort, while in the edit-mode. It also does not make sense for you to click the Edit button while in the edit-mode.

    After you have just finished typing, the corresponding row in the recordset cannot be automatically changed or the changed copy automatically created in the Transmitted Table. An event has to be triggered before this can happen. It is up to us to decide what event should be triggered.

    For this, I decided that if any of the enabled buttons is clicked, the text input controls should be made read-only, the corresponding row in the recordset changed, and a copy of the changed row should be added to the Transmitted Table. Then any button that was disabled, because the Edit button was clicked, is enabled. This action ends the edit process.

    The Delete Operation

    If you are not in the Add or Edit mode, you can delete any row by clicking the Delete button. When you do that, a copy of the row is first created in the Transmitted Table, then at the recordset, the first six fields of the row are given the value “DELETED.” The fields of the text Input controls are also given the value “DELETED.” When the user navigates to this row he should see “DELETED” as the field data.

    Recall that it is the content of the Transmitted Table that is sent to the server. At the end of each row in the Transmitted Table is the word ADDED, EDITED or DELETED, to indicate what happened in the row in the recordset. The program file at the server will then affect the database accordingly.

    The Clear Operation

    The clear operation clears the fields of the text Input controls. It does not delete any row in the recordset or Transmitted Table. The clear operation is only allowed in the add-mode for you to erase all of what you have just typed.

    The Save Operation

    Note that you can click the Save button after you have just finished typing while in the Add or Edit mode. The Save operation first verifies that you were in the add-mode. If you were, it completes the Add process. It also verifies that you were in the Edit mode. If you were, it completes the Edit process. It then sends the content of the Transmitted Table to the server.

    The Done Operation

    When you click the Done button, you go into the Done process. The Done operation does what the Save operation does, and then closes the browser window.

    Find and Sort Operations

    These operations were explained in the first part of this series. However, note here that neither of them can occur in the Add or Edit mode.

    More on the Transmitted Table

    The content of an HTML TABLE CELL cannot be sent to the server when the Submit button of the HTML FORM element is clicked. So, each Table Cell of the Transmitted Table has an HTML INPUT element. It is the name/value pair of each of these INPUT elements that is sent to the server.

    Important Variables

    The recordset is a program language container, and like all such containers, its value can be accessed with an index. So there is a global variable in our JavaScript code, called index.

    We always have to know the total number of rows of the recordset; the global variable called numberOfRows is used for this.

    Index values always begin from zero upward, and not from 1 upward. However, in order to indicate the row position we have to use values from 1 upward, to satisfy the user. So, to obtain the row position, we always have to add 1 to the value of the index. Also, the maximum index value is (numberOfRows - 1).

    We use the global variable named addMode to indicate that the form is in the add-mode. In this mode,

    AddMode = true;

    Out of the add-mode,

    AddMode = false; //the default


    We use the global variable named editMode to indicate that the form is in the edit-mode. In this mode,

    editMode = true;

    Out of the edit-mode,

    editMode = false; //the default


    More HTML Articles
    More By Chrysanthus Forcha


       · The story has to continue.Chrys
     

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