spacer

Webref WebRef   Sitemap · Experts · Tools · Services · Newsletters · About i.com

home / programming / javascript / hform / 1 To page 1current page
[previous]

Sr Instructional Designer D2L-Moodle,Clearance
WSI Nationwide, Inc.
US-NJ-Fort Monmouth

Justtechjobs.com Post A Job | Post A Resume
Developer News
News Flash: Adobe Has iPhone Workaround
Adobe's Flash 10.1 Goes Mobile (Minus iPhone)
A Salute to Visionary CEOs


The HTML Form Element

Form Controls

Some more common controls or children elements for a form are as follows.

button : a developer may create 3 types of buttons:

  • type="button" A simple push button that will require some scripting to make it responsive to user clicks.
  • type="reset" A reset button that will reset the form controls to their initial values.
  • type="submit" A submit button that when clicked will submit the form to a given action attribute.
checkboxes : Are on/off switches. A checkbox may be considered "on" when it's checked. Only checkboxes that are on are passed to the webserver form processing application with the control name in the following format:

name=on

The checkbox controls are created using the input element and by setting type="checkbox"

file : This control is used to upload files to the form processing application with the form submission. You will have to make sure that you use method="post" and enctype="multipart/form-data" whenever you're uploading files. The file control is created using input element and setting the type="file"

hidden controls : These are controls that are not visible by a client user, but their content may be sent to the form processing applications when a form is submitted. Be aware that hidden controls and all other controls (set to be hidden using style sheets) may be passed onto the form processing application. The hidden controls are created using the input element and setting the type="hidden"

menu : Menu controls are set using the select element in combination with option elements. The HTML standards require that a select element must contain least one option element.

object : Object controls are used to embed music, video or flash movies in an HTML document.

radio : Are on/off switches. Radio buttons are created in a set/group of radio buttons. i.e. A group of radio buttons may share same value for name attribute, and only the button that is on will be passed on to the form processing applications. A developer should set at least one radio button in a group to "on" The radio controls are created using input element and setting the type="radio"

text : There are two types of input controls:

1. One is created using input element and setting the type="text"
2. A textarea element

The only difference between the two is that the first creates a single line input area whereas the latter creates a multiple lines input area.

A detailed list of Form Controls can be viewed here.

Some Form Submission Tips

onsubmit="return validatinJSFunction();"

Finally, make sure that you set the return type of your JS function to true or false depending upon the logic you've used. This will make sure that when JavaScript is enabled, a form does is not submitted when it's not required.

Khalid Ali is a Freelance Developer who works out of Calgary, Alberta, in Canada. Over several years, he has participated in projects involving various programming languages, including VB, C/C++ and Java. His web related experience includes projects using Java servlets/jsp XML/XSL and Javascript/DHTML/XSS/HTML. Khalid can be reached at via email k_ali@shaw.ca

home / programming / javascript / hform / 1 To page 1current page
[previous]

internet.commediabistro.comJusttechjobs.comGraphics.com

Search:

WebMediaBrands Corporate Info

Legal Notices, Licensing, Reprints, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs

webref The latest from WebReference.com Browse >
Building a Banking Application Home Page with OOP · Mixing Scripting Languages · Review: phpFox, a Social Networking CMS with all the Bells and Whistles
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Enterprise 2.0: Social Networking in the Cloud · BroadSoft Marketplace Hastens Pace of Telephony Innovation · Review: HTC Hero for Sprint

Created: June 2, 2003
Revised: October 16, 2003

URL: http://webreference.com/programming/javascript/hform