Home arrow HTML arrow Page 5 - Building Single Row Database Forms with HTML
HTML

Building Single Row Database Forms with HTML


Welcome to the second chapter of a thirteen part series about creating database forms with HTML. In this article, we will continue our discussion on single-row forms and explain how to send changes to the server database. We will also go over the recordset and the common functions used to manipulate the corresponding form.

Author Info:
By: Chrysanthus Forcha
Rating: 5 stars5 stars5 stars5 stars5 stars / 4
July 16, 2008
TABLE OF CONTENTS:
  1. · Building Single Row Database Forms with HTML
  2. · Sending Changes to Server Database
  3. · The Form Code
  4. · The Nature of the Recordset
  5. · The disableButtons(selectedButtons) Function

print this article
SEARCH DEVARTICLES

TOOLS YOU CAN USE

advertisement
Building Single Row Database Forms with HTML - The disableButtons(selectedButtons) Function
(Page 5 of 5 )

Before I give you the code for this function, let me first describe a JavaScript feature that you may not be familiar with. When you call a JavaScript function, the called function develops an internal array. The first element ([0]) of this array holds the first argument of the parameter list of arguments received by the function, the second element of the array holds the second argument of the parameter list, the third element holds the third argument, and so on. The length of the array is the number of arguments in the parameter list. The length of the array depends on the number of arguments you send in the parameter list and this number depends on you.

I use this feature in this function - "disableButtons(selectedButtons).” The name of this array is “arguments.” This name is given by JavaScript and is the same for all JavaScript functions called. The array is internal to the function and you do not see its construction. To obtain its length, you type “arguments.length.” The “disableButtons(selectedButtons)” function is used to disable the selected button. The “selectedButtons” parameter simply represents the list of IDs of the buttons you want disabled. The list can be of any length. The code for the function is:


function disableButtons(selectedButtons)

{

for (i=0; i<arguments.length; i++)

{

document.getElementById(arguments[i]).disabled = true;

}

}


You do not access the IDs using “selectedButtons,” you access them using “arguments[i].”

The enableButtons(selectedButtons)

You use this function to enable selected buttons. The explanation is similar to the one above. The code is:


function enableButtons(selectedButtons)

{

for (i=0; i<arguments.length; i++)

{

document.getElementById(arguments[i]).disabled = false;

}

}


The clearControls() Function

This function is used to clear the text Input controls, NOT the values in the rows of the recordset. You achieve this by setting the value of a text Input element to “”. The code is:


function clearControls()

{

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

{

ID = "EI" + j; //forming the control ID

document.getElementById(ID).value = "";

}

}


These are common functions written by us to use.

We continue in the next part of the series.


DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

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 7 - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials