Home arrow HTML arrow Tabular Database Form Functions with HTML
HTML

Tabular Database Form Functions with HTML


Welcome to the ninth part of a thirteen-part series on HTML database forms. In the previous part we began our discussion of Tabular forms, having dealt with Single-Row forms up until that point. In this part we continue our discussion of what functions to use with Tabular forms and how they are different from their Single-Row counterparts.

Author Info:
By: Chrysanthus Forcha
Rating: 4 stars4 stars4 stars4 stars4 stars / 6
September 10, 2008
TABLE OF CONTENTS:
  1. · Tabular Database Form Functions with HTML
  2. · The editRow() Function
  3. · The includeInTransmittedTable()
  4. · The deleteRow() Function
  5. · The swap() and quickSort() Function

print this article
SEARCH DEVARTICLES

Tabular Database Form Functions with HTML
(Page 1 of 5 )

The selectRow() Function

Before you can edit or delete, a row has to be selected. You select a row by simply clicking on it. When you do that the click event calls the selectRow() function. This function has as an argument the ID of the row clicked. With this ID the SelectRow() function changes the background color of the row to blue. Now you will see only the outline of the row because the Input Text Controls are covering much of its background.

From the row ID, the selectRow() function obtains the row position (minus 1) and makes that the index. Recall that our index variable indicates the row position that is active. This is the selectRow() function with an associated variable:


var oldRowID = ""; //when a new row is selected, use this to deselect the old row


//function to indicate that row is selected

function selectRow(ID)

{

document.getElementById(ID).style.backgroundColor = "blue";

if ((oldRowID != "")&&(oldRowID != ID))

document.getElementById(oldRowID).style.backgroundColor = "transparent";

index = parseInt(ID.charAt(2));

oldRowID = ID;

}



The effectAddEdit() function

The user clicks the conspicuous button when he has just finished typing in the ADD or EDIT mode. When he clicks the button, this function is called. The function checks to see if you were in the add mode. If you were, it adds the record to the Transmitted table. It then resets the addMode variable and makes the new row read-only, by calling the "makeReadOnlyInputControls()" function, which now takes the index as its argument.

The function also checks whether you were in the edit mode. If you were, it behaves in a manner similar to the way it did for the add mode. 

The last thing the function does is enable all the buttons and then remove the conspicuous button (until it is needed again). This is the function:



function effectAddEdit()

{

//Add to transmitted table

if (addMode == true)

{

//include the added row in the transmitted table

includeInTransmittedTable('ADDED');

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

addMode = false;

makeReadOnlyInputControls(index);

}


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

if (editMode == true)

{

//include the added row in the transmitted table

includeInTransmittedTable('EDITED');

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

editMode = false;

makeReadOnlyInputControls(index);

}

 

enableButtons('A1','E1','D1','C1','So1','S1','Do1');

//remove the button that sent the added row to the transmitted table

document.getElementById('TDAE1').style.display = "none";

}




blog comments powered by Disqus
HTML ARTICLES

- Does HTML5 Need a Main Element?
- Revisiting the HTML5 vs. Native Debate
- HTML5: Not for Phone Apps?
- HTML5 or Native?
- Job Hunting? Freelancer.com Lists This Quart...
- HTML5 in the News
- Report: HTML5 Mobile Performance Lags
- The Top HTML5 Audio Players
- Top HTML5 Video Tutorials
- HTML5: Reasons to Learn and Use It
- More of the Top Tutorials for HTML5 Forms
- MobileAppWizard Releases HTML5 App Builder
- HTML5 Boilerplate: Working with jQuery and M...
- HTML5 Boilerplate Introduction
- New API Platform for HTML5

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 

Developer Shed Affiliates

 




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