HTML
  Home arrow HTML arrow Page 2 - Sorting for Database Forms 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 
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

Sorting for Database Forms with HTML
By: Chrysanthus Forcha
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 2
    2008-08-13

    Table of Contents:
  • Sorting for Database Forms with HTML
  • The sort() Function continued
  • The getColumnIndex() Function
  • The titleBoolArr Array

  • 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


    Sorting for Database Forms with HTML - The sort() Function continued


    (Page 2 of 4 )

    Do not get confused between the sort() function and the quickSort() function. The quickSort() function actually does the sorting. The sort() function calls the quickSort() function.

    The sort() function first issues a prompt dialog box. The user types in the title of the column based on what sorting will take place. When the prompt dialog box is issued, the program stops and can only continue when the OK or Cancel button of the prompt box is clicked. The prompt box returns the title that the user typed in. The line of code that is responsible for all this is:


    var title = prompt("Enter the Title of the Column for Sorting", "Name");


    “Name” is the title of a column. I expect that the user will usually want to sort the recordset by Name. That is why you have the word “Name” in the above line of code. So the word “Name” will appear already typed for the user in the prompt dialog box.

    If the Cancel button is clicked, the prompt function returns “null.” If you delete what is in the box and click its OK button, an empty string (“”) will be returned. Under these two conditions, the quickSort() function will not be called. Otherwise, the sort() function gets the column index using the title returned by the prompt function. The line for this is:


    var titleInx = getColumnIndex(title); //the column index of the recordset


    Just as the recordset rows have indices beginning with zero, the columns also have indices beginning with zero. I will give you the details of the getColumnIndex() function shortly. If the function sees the index of the column, it will return it. If it doesn’t see the index, it returns the number 6, which is the total number columns made visible to the user. Remember that the last (seventh) row of the recordset has either the number –1 or an index value of the transmitted table. The values of this last column are not shown to the user. If the index is seen, a number from 0 to 5 will be returned.

    If the function does not see the index, it means that whatever the user typed into the prompt box is incorrect; the sort() function then alerts the user of this and returns after you click the OK button of the alert box. Note that whenever a function returns, all the lines of code below the return statement in the function are not executed. If the column (title) exists, the quickSort() function is called.

    The quickSort() function receives the first row index (0) of the recordset, the last row index (numberOfRows - 1) of the recordset, and the column index (titleInx) as parameters. The sorting takes place based on a column (titleInx) for a column in the recordset. The quickSort() function does not return any value; it rearranges the rows of the recordset in ascending order based on a column.

    The sort() function then displays the contents of the first row in the input controls of the form. Lastly, the sort() function calls the setTitleBool(title) function, which indicates in the titleBoolArr array that the particular column is sorted. We shall see the details of this shortly.

    More HTML Articles
    More By Chrysanthus Forcha


       · We have gone this far! There can be no turning back.Chrys
     

    HTML ARTICLES

    - Comparing Browser Response to Active Client ...
    - Testing Browser Response to Active Client Pa...
    - Active Client Pages: Completing the Code for...
    - ACP and Browsers: Setting up an Example
    - How Browsers Respond to Active Client Pages
    - Completing a Tree with Active Client Pages
    - HTML Form Verification and ACP
    - Building an ACP Tree
    - Completing an ACP 3D HTML Table Image Gallery
    - Building an ACP 3D HTML Table Image Gallery
    - A Multiple Page Image Gallery with Active Cl...
    - Building an Image Gallery with Active Client...
    - Concluding a Menu for All Browsers
    - A Vertical Menu for All Browsers
    - Downloading Long HTML Pages with ACP







    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 2 Hosted by Hostway
    Stay green...Green IT