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

TOOLS YOU CAN USE

advertisement
Tabular Database Form Functions with HTML - The includeInTransmittedTable()
(Page 3 of 5 )

With the Single-Row Form the recordset did not have Input Text Controls. This has to be taken into consideration here. This is the new includeInTransmittedTable() function with an associated variable:


//variable for row index of the Transmitted table

var indexTT = 0;


//function to include the processed data row to the Transmitted table

function includeInTransmittedTable(Decision)

{

var recordsetRowNo = numberOfRows - 1;

var check = -1; //to check if recordset row has already been edited.

var oldIndexTT;

 

//When Decision is EDITED first check if the recordset row has already been edited.

if (Decision == "EDITED")

{

recordsetRowNo = index;

check = document.getElementById('Recordset').rows[index].cells[6].innerHTML;

if (check != -1)

{//row has been edited

recordsetRowNo = index;

oldIndexTT = indexTT;

indexTT = check;

}

}

 

//When Decision is DELETED

if (Decision == "DELETED")

{

recordsetRowNo = index;

}


//insert a blank row if no editing has taken place in the recordset row concerned

if (check == -1)

{

document.getElementById('TransmittedTable').insertRow(indexTT);

}

 

//insert blank cells and give them the corresponding data of the row you

//have processed from the recordset.

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

{

//insert blank cells if no editing has taken place in the recordset row concerned

if (check == -1)

{

document.getElementById('TransmittedTable').rows[indexTT].insertCell(j);

}

//form the name of the transmitted INPUT element

tName = "T" + indexTT + j;

 

//form the input text control ID of the recordset

ID = "EI" + recordsetRowNo + j;

 

document.getElementById(ID).readOnly=true;

document.getElementById('TransmittedTable').rows[indexTT].cells[j].innerHTML = '<input type="text" ' + 'name=' + tName + ' value="'

+ document.getElementById(ID).value

+ '">';

}

 

//insert additional cell and the content ADDED, DELETED or UPDATED accordingly

if (check == -1)

{

document.getElementById('TransmittedTable').rows[indexTT].insertCell(6);

document.getElementById('TransmittedTable').rows[indexTT].cells[6].innerHTML = '<input type="text" ' + 'name=' + 'T' + indexTT + '6' + ' value="' + Decision + '">';

}

 

if (check == -1)

{//you had not already edited the recordset row.

//if you are editing for the first time

if (Decision == "EDITED")

{

document.getElementById('Recordset').rows[index].cells[6].innerHTML = indexTT;

}

//The next row index for the Transmitted table is

indexTT+=1;

}

else

{//you had already edited the recordset row so give back the normal indexTT value.

indexTT = oldIndexTT;

}

 

}




blog comments powered by Disqus
HTML ARTICLES

- HTML5 Boilerplate: Working with jQuery and M...
- HTML5 Boilerplate Introduction
- New API Platform for HTML5
- BBC Adopts HTML 5, Mozilla Addresses Issues
- Advanced Sticky Footers in HTML and CSS
- HTML and CSS Sticky Footers
- Strategy Analytics Predicts HTML5 Phones to ...
- HTML5 Guidelines for Web Developers
- Learning HTML5 Game Programming
- More Engaging CSS3 and HTML Background Effec...
- Engaging HTML and CSS3 Background Effects
- More Web Columns with CSS3 and HTML
- Columns with CSS3 and HTML
- Creating Inline-Block HTML Elements with CSS
- Drag and Drop in HTML5: Parsing Local Files

Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 



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