All Topics  
Form (web)

 

   Email Print
   Bookmark   Link






 

Form (web)



 
 
A webform on a web page
Web page

A web page or webpage is a resource of information that is suitable for the World Wide Web and can be accessed through a web browser.This information is usually in HyperText Markup Language or eXtensible HyperText Markup Language format, and may provide Navigation bar to other web pages via hypertext Hyperlink....
 allows a user to enter data that is sent to a server
Server (computing)

A server is a computer program that provides services to other computer programs , in the same or other computer. The physical computer that runs a server program is also often referred to as server....
 for processing. Webforms resemble paper forms
Form (document)

A form is a document with spaces in which to writing or select, for a series of documents with similar contents. The documents usually have the printed parts in common, possibly except for a serial number....
 because internet users fill out the forms using checkboxes, radio buttons, or menus. For example, webforms can be used to enter shipping or credit card data to order a product or can be used to retrieve data (e.g., searching on a search engine
Search engine

A search engine is an information retrieval designed to help find information stored on a computer system. The search results are usually presented in a list and are commonly called hits....
).

In addition to functioning as input templates for new information webforms can also be used to query and display existing data in a similar manner to mail merge
Mail merge

Mail merge is a software function describing the production of multiple documents from a single Template form and a structured Database....
 forms, with the same advantages.






Discussion
Ask a question about 'Form (web)'
Start a new discussion about 'Form (web)'
Answer questions from other users
Full Discussion Forum



Encyclopedia


A webform on a web page
Web page

A web page or webpage is a resource of information that is suitable for the World Wide Web and can be accessed through a web browser.This information is usually in HyperText Markup Language or eXtensible HyperText Markup Language format, and may provide Navigation bar to other web pages via hypertext Hyperlink....
 allows a user to enter data that is sent to a server
Server (computing)

A server is a computer program that provides services to other computer programs , in the same or other computer. The physical computer that runs a server program is also often referred to as server....
 for processing. Webforms resemble paper forms
Form (document)

A form is a document with spaces in which to writing or select, for a series of documents with similar contents. The documents usually have the printed parts in common, possibly except for a serial number....
 because internet users fill out the forms using checkboxes, radio buttons, or menus. For example, webforms can be used to enter shipping or credit card data to order a product or can be used to retrieve data (e.g., searching on a search engine
Search engine

A search engine is an information retrieval designed to help find information stored on a computer system. The search results are usually presented in a list and are commonly called hits....
).

In addition to functioning as input templates for new information webforms can also be used to query and display existing data in a similar manner to mail merge
Mail merge

Mail merge is a software function describing the production of multiple documents from a single Template form and a structured Database....
 forms, with the same advantages. The decoupling of message structure and underlying data allow both to vary independently. The use of webforms for this purpose avoids the problems associated with explicitly creating separate web pages for each record in a database.

Webforms are defined in formal programming languages such as HTML
HTML

HTML, an Acronym and initialism of HyperText Markup Language, is the predominant markup language for Web pages. It provides a means to describe the structure of text-based information in a document?by denoting certain text as links, headings, paragraphs, lists, and so on?and to supplement that text with interactive forms, embedded '...
, Perl
Perl

In computer programming, Perl is a high-level programming language, List of programming languages by category, Interpreter , dynamic programming language....
, Java
Java (programming language)

Java is a programming language originally developed by James Gosling at Sun Microsystems and released in 1995 as a core component of Sun Microsystems' Java ....
 or .NET
.NET Framework

The Microsoft .NET Framework is a software framework that is available with several Microsoft Windows operating systems. It includes a large Library of coded solutions to prevent common programming problems and a virtual machine that manages the execution of programs written specifically for the Software framework....
. The implementation of these language often invoke user interface idioms automatically, such as grids and themes
Theme (computing)

In computing, a theme is a preset package containing graphical appearance details, used to customize the look and feel of an operating system, widget set or window manager....
, minimizing programming time, costs and risks.

XHTML/HTML forms

Sample Web Form
A form in XHTML
XHTML

The Extensible Hypertext Markup Language, or XHTML, is a markup language that has the same depth of expression as HTML, but also conforms to XML syntax....
 or HTML
HTML

HTML, an Acronym and initialism of HyperText Markup Language, is the predominant markup language for Web pages. It provides a means to describe the structure of text-based information in a document?by denoting certain text as links, headings, paragraphs, lists, and so on?and to supplement that text with interactive forms, embedded '...
 is by far the most common way to use a form online.

The following elements can make up the user-inputting portion of a form:
  • input field
    • text – a simple text box
      Text box

      A text box, text field or text entry box is a common element of graphical user interface of computer programs, as well as the corresponding type of widget used when programming GUIs....
       that allows input of a single line of text
    • checkbox – a check box
      Check box

      In computing, a check box is a graphical user interface element that permits the user to make multiple selections from a number of options. Normally, check boxes are shown on the screen as a square box that can contain Whitespace or a Tick or X , as pictured....
    • radio – a radio button
      Radio button

      A radio button or option button is a type of graphical user interface elements of graphical user interfaces that allows the user to choose one of a predefined set of options....
    • file – a file select
      File select

      In HTML, a file-select control is a component of a form with which a user can select a file from his local machine. When the form is submitted , the file is uploaded to the web server....
       control for uploading a file
    • reset – a reset button
      Reset button

      In electronics and technology, a reset button is a button that can reset a machine. On video game consoles, the reset button restarts the game, losing the player's unsaved progress....
       that, when activated, tells the browser to restore the values to their initial values.
    • submit – a button
      Button (computing)

      In computing, a button is a user interface element that provides the user a simple way to trigger an event , like searching for a query at a search engine, or to interact with dialog boxes, like confirming an action....
       that tells the browser to take action on the form (typically to send it to a server)
  • textarea – much like the text input field except a textarea allows for multiple rows of data to be shown and entered
  • select – a drop-down list
    Drop-down list

    A drop-down list is a user interface Widget Graphical user interface element, similar to a list box, which allows the user to choose one value from a list....
     that displays a list of items a user can select from


The sample image on the right shows all of these elements:
  • a text box
    Text box

    A text box, text field or text entry box is a common element of graphical user interface of computer programs, as well as the corresponding type of widget used when programming GUIs....
     asking for your name
  • a pair of radio button
    Radio button

    A radio button or option button is a type of graphical user interface elements of graphical user interfaces that allows the user to choose one of a predefined set of options....
    s asking you to pick your sex
  • a select box
    Drop-down list

    A drop-down list is a user interface Widget Graphical user interface element, similar to a list box, which allows the user to choose one value from a list....
     giving you a list of eye colors to choose from
  • a pair of check box
    Check box

    In computing, a check box is a graphical user interface element that permits the user to make multiple selections from a number of options. Normally, check boxes are shown on the screen as a square box that can contain Whitespace or a Tick or X , as pictured....
    es to click on if they apply to you
  • a text area to describe your athletic ability
  • a submit button
    Button (computing)

    In computing, a button is a user interface element that provides the user a simple way to trigger an event , like searching for a query at a search engine, or to interact with dialog boxes, like confirming an action....
     to send it to the server


These basic elements provide most possible graphical user interface
Graphical user interface

A graphical user interface is a type of user interface which allows people to human-computer interaction such as computers; hand-held devices such as MP3 Players, Portable Media Players or Gaming devices; household appliances and office equipment....
 (GUI) elements, but not all. For example, there are no equivalents to a combo box
Combo box

A combo box is a commonly-used graphical user interface Widget . It is a combination of a drop-down list or list box and a single-line Text box, allowing the user to either type a value directly into the control or choose from the list of existing options....
, balloon help
Balloon help

Balloon help was a help system introduced by Apple Computer in their 1991 release of System 7 . The name referred to the way the help text was displayed, in "speech balloon", like those containing the words in a comic strip....
, tree view
Tree view

A tree view or an outline view is a graphical user interface element that presents a hierarchy#Containment hierarchy view of information....
, or grid view
Grid view

A grid view or a datagrid is a graphical user interface element that presents a tabular view of data. A typical grid view also supports some or all of the following:...
. A grid view, however, can be mimicked by using a standard HTML table with each cell containing a text input element. A tree view could also be mimicked through nested tables or, more semantically
HTML

HTML, an Acronym and initialism of HyperText Markup Language, is the predominant markup language for Web pages. It provides a means to describe the structure of text-based information in a document?by denoting certain text as links, headings, paragraphs, lists, and so on?and to supplement that text with interactive forms, embedded '...
 appropriately, nested lists
HTML element

In computing, an HTML element indicates structure in an HTML document and a way of hierarchically arranging content. More specifically, an HTML element is an Standard Generalized Markup Language element that meets the requirements of one or more of the HTML Document Type Definitions ....
. Many of these are available through JavaScript libraries
JavaScript library

A JavaScript library is a Library of pre-written JavaScript controls which allow for easier development of JavaScript-based applications, especially for Ajax and other World Wide Web-centric technologies....
.

XForms


XForms is an alternative standard that was designed to represent the next generation of HTML / XHTML forms. It is also a standard that is generic enough to be used in a standalone manner or with presentation languages other than HTML or XHTML to describe forms in other user interfaces. Unlike HTML / XHTML forms, XForms uses a Model-View-Controller
Model-view-controller

Model?View?Controller is an Architectural pattern used in software engineering. Successful use of the pattern isolates business logic from user interface considerations, resulting in an application where it is easier to modify either the visual appearance of the application or the underlying business rules without affecting the other....
 approach.

An XForms document can be as simple as an HTML / XHTML web form. but XForms includes many advanced features. For example, the form can react in real time and request and retrieve new information while it is still being displayed, without the use of a separate scripting language. The form can specify how its data should be validated
Data validation

In computer science, data validation is the process of ensuring that a program operates on clean, correct and useful data. It uses routines, often called "validation rules" or "check routines", that check for correctness, meaningfulness, and security of data that are input to the system....
 or how portions of the form may change depending on data entered in other parts of the form.

Unlike HTML / XHTML forms, XForms is not yet supported on currently available web browsers.

Combined with programs

Forms can be combined with various scripting language
Scripting language

A scripting language, script language or extension language, is a programming language that allows some control of a single or many Application software....
s to allow developer
Software developer

A software developer is a person or organization concerned with facets of the software development process wider than design and coding, a somewhat broader scope of computer programming or a specialty of project manager including some aspects of Software product management....
s to create dynamic web sites. This includes both client-side and/or server-side languages.

Client-side


Simple mailto: actions.

The de facto
De facto

De facto is a Latin expression that means "concerning the fact" or in practice but not necessarily ordained by law. It is commonly used in contrast to de jure when referring to matters of law, governance, or technique that are found in the common experience as created or developed without or contrary to a regulation....
 standard
Standardization

Standardization is the process of developing and agreeing upon Standard . A standard is a document that establishes uniform engineering or technical specifications, criteria, methods, processes, or practices....
 client-side scripting language for web sites is JavaScript
JavaScript

JavaScript is a scripting language widely used for client-side web development. It was the originating Programming language dialect of the ECMAScript standard....
. Utilizing JavaScript on the Document Object Model
Document Object Model

The Document Object Model is a platform- and programming language-independent standard object model for representing HTML or XML documents as well as an Application Programming Interface for querying, traversing and manipulating such documents....
 (DOM) leads to the method of Dynamic HTML
Dynamic HTML

Dynamic HTML, or DHTML, is a collection of technologies used together to create interactive and animated web sites by using a combination of a static markup language , a client-side scripting language , a presentation definition language , and the Document Object Model....
 that allows dynamic creation and modification of a web page within the browser.

While client-side languages used in conjunction with forms are limited, they often can serve to do pre-validation
Validation

The word validation has several uses:* In common usage, validation is the process of checking if something satisfies a certain criterion. Examples would include checking if a statement is true , if an appliance works as intended, if a computer system is secure, or if computer data are compliant with an open standard....
 of the form data and/or to prepare the form data to send to a server-side program.

Server-side

Server-side programs can do a vast assortment of tasks to create dynamic web sites — from authenticating
Authentication

Authentication is the act of establishing or confirming something as authentic, that is, that claims made by or about the subject are true....
 a login
Login

selfref|For Wikipedia login, see...
 through, for example, Lightweight Directory Access Protocol
Lightweight Directory Access Protocol

The Lightweight Directory Access Protocol, or LDAP , is an application protocol for querying and modifying directory services running over Internet protocol suite....
 to retrieving and storing data in a database
Database

A database is a structured collection of records or data that is stored in a computer system. The structure is achieved by organizing the data according to a database model....
 to spell checking
Spell checker

In computing, a spell checker is an application software that flags words in a document that may not be spelling correctly. Spell checkers may be stand-alone capable of operating on a block of text, or as part of a larger application, such as a word processor, email client, electronic dictionary, or search engine....
 to sending e-mail
E-mail

Electronic mail, often abbreviated as e-mail, email, E-Mail, or eMail, is any method of creating, transmitting, or storing primarily text-based human communications with digital communications systems....
 — quite unlike client-side programs. Most server-side program requests must pass through the web server
Web server

The term web server can mean one of two things:# A computer program that is responsible for accepting Hypertext Transfer Protocol requests from clients , and Server them HTTP responses along with optional data contents, which usually are web pages such as Hypertext Markup Language documents and linked objects ....
's Common Gateway Interface
Common Gateway Interface

The Common Gateway Interface is a Standardization Protocol for interfacing external application software with an Server , commonly a web server....
 to execute
Execution (computers)

Execution in computer engineering and software engineering is the Process by which a computer or a virtual machine carries out the instructions of a computer program....
 the program to actually perform the tasks.

The advantage of server-side over client-side is the concentration of functionality onto one computer (the server) instead of relying on each web browser
Web browser

A Web browser is a application software which enables a user to display and interact with text, images, videos, music, games and other information typically located on a Web page at a website on the World Wide Web or a local area network....
 implementing all of the various functions the same. This very problem is quite evident to any developer who writes JavaScript
JavaScript

JavaScript is a scripting language widely used for client-side web development. It was the originating Programming language dialect of the ECMAScript standard....
 code for multiple browsers.

Scripting language
Scripting language

A scripting language, script language or extension language, is a programming language that allows some control of a single or many Application software....
s are the most common server-side programs used for web sites, but it is also possible to run compiled programs.

Some of the scripting languages commonly used:
  • PHP
    PHP

    PHP is a scripting language originally designed for producing dynamic web pages. It has evolved to include a command line interface capability and can be used in Standalone software Graphical user interface....
  • Perl
    Perl

    In computer programming, Perl is a high-level programming language, List of programming languages by category, Interpreter , dynamic programming language....
  • ASP
    Active Server Pages

    Active Server Pages , also known as Classic ASP, was Microsoft's first server-side scripting Active Scripting for dynamic web page. Initially released as an add-on to Internet Information Services via the Windows_NT_4.0#Option_Pack, it was subsequently included as a free component of Windows Server ....
  • ASP.NET
    ASP.NET

    ASP.NET is a web application framework developed and marketed by Microsoft to allow programmers to build dynamic web sites, web applications and web services....
  • Adobe ColdFusion
  • JSP
    JavaServer Pages

    JavaServer Pages is a Java technology that allows software developers to create dynamic web page, with HTML, XML, or other document types, in response to a Web client request....


Some of the compiling languages commonly used:
  • C
    C (programming language)

    C is a general-purpose computer programming language originally developed in 1972 by Dennis Ritchie at the Bell Telephone Laboratories to implement the Unix operating system....
  • C++
    C++

    C++ is a general-purpose programming language. It is regarded as a middle-level language, as it comprises a combination of both high-level programming language and low-level programming language language features....
  • C#
    C Sharp

    C# is a multi-paradigm programming language that encompasses Functional programming, Imperative programming, Generic programming, Object-oriented programming , and Component-based software engineering programming disciplines....
  • Java
    Java (programming language)

    Java is a programming language originally developed by James Gosling at Sun Microsystems and released in 1995 as a core component of Sun Microsystems' Java ....


PHP
PHP
PHP

PHP is a scripting language originally designed for producing dynamic web pages. It has evolved to include a command line interface capability and can be used in Standalone software Graphical user interface....
 is one very common language used for server-side languages and is one of the few languages created specifically for server-side programs.

A PHP script may:
  • display the information on another page (ex: asking for a user's name and then displaying it on the web page)
  • act as a logon interface
  • post the data to a database (ex: mySQL
    MySQL

    MySQL is a relational database management system which has more than 11 million installations. The program runs as a server providing multi-user access to a number of databases....
    , an ASCII
    ASCII

    American Standard Code for Information Interchange , is a coding standard that can be used for interchanging information, if the information is expressed mainly by the written form of English words....
     file, etc.)
  • store the information on the viewer's computer in an HTTP cookie
    HTTP cookie

    HTTP cookies, more commonly referred to as World Wide Web cookies, tracking cookies or just cookies, are parcels of text sent by a Web server to a Web Client and then sent back unchanged by the client each time it accesses that server....
  • generate an e-mail
    E-mail

    Electronic mail, often abbreviated as e-mail, email, E-Mail, or eMail, is any method of creating, transmitting, or storing primarily text-based human communications with digital communications systems....
    , either using the data or including said data in the e-mail's contents (possibly as an e-mail attachment
    E-mail attachment

    An e-mail attachment is a computer file which is sent along with an E-mail. The file is not a separate message, but now it is almost universally sent as part of the message to which it is attached....
    )


The HTML form learns where to pass the data from the action attribute of the form's HTML element
HTML element

In computing, an HTML element indicates structure in an HTML document and a way of hierarchically arranging content. More specifically, an HTML element is an Standard Generalized Markup Language element that meets the requirements of one or more of the HTML Document Type Definitions ....
. The target PHP file then retrieves the data either through POST or GET (see HTTP for more information), depending on the programmer
Programmer

A programmer is someone who writes computer software. The term computer programmer can refer to a specialist in one area of computer programming or to a generalist who writes code for many kinds of software....
's preference. Here is a basic form handler PHP script that will post the form's contents, in this case "user", to the page using GET:

form.html
User Name:


form_handler.php
$name = $_GET['user']; echo "Hello, ". $name ."!"; ?>

In the above script the $_GET[] and $_POST[] commands need to be changed, depending on what is used in the form, however $_REQUEST[] is used for both so it is more efficient to use for form collection.

Perl

Perl
Perl

In computer programming, Perl is a high-level programming language, List of programming languages by category, Interpreter , dynamic programming language....
 is another language often used for web development
Web development

Web development is a broad term for any activity related to developing a web site for the World Wide Web or an intranet. This can include e-commerce business development, web design, web content development, Client-side scripting/server-side scripting programming, and web server configuration....
. Perl scripts are traditionally used as Common Gateway Interface
Common Gateway Interface

The Common Gateway Interface is a Standardization Protocol for interfacing external application software with an Server , commonly a web server....
 applications (CGIs). In fact, Perl is such a common way to write CGIs that the two are often confused. CGIs may be written in other languages than Perl (compatibility with multiple languages is a design goal of the CGI protocol) and there are other ways to make Perl scripts interoperate with a web server
Web server

The term web server can mean one of two things:# A computer program that is responsible for accepting Hypertext Transfer Protocol requests from clients , and Server them HTTP responses along with optional data contents, which usually are web pages such as Hypertext Markup Language documents and linked objects ....
 than using CGI (such as FastCGI
FastCGI

FastCGI is a Protocol for interfacing interactive programs with a web server. FastCGI is a variation on the earlier Common Gateway Interface ; FastCGI's main aim is to reduce the overhead associated with interfacing the web server and Common Gateway Interface programs, allowing a server to handle more web page requests at once....
 or Apache
Apache HTTP Server

The Apache HTTP Server, commonly referred to simply as Apache , is a web server notable for playing a key role in the initial growth of the World Wide Web....
's mod perl
Mod perl

mod_perl is an optional module for the Apache HTTP server. It embeds a Perl Interpreter into the Apache server, so that dynamic content produced by Perl Scripting language can be served in response to incoming requests, without the significant overhead of re-launching the Perl interpreter for each request....
).

Perl CGIs were once a very common way to write web applications. But not being specifically designed for web development, Perl is now often viewed as less practical (both for developers and users) than specialized languages like PHP
PHP

PHP is a scripting language originally designed for producing dynamic web pages. It has evolved to include a command line interface capability and can be used in Standalone software Graphical user interface....
 or ASP
Active Server Pages

Active Server Pages , also known as Classic ASP, was Microsoft's first server-side scripting Active Scripting for dynamic web page. Initially released as an add-on to Internet Information Services via the Windows_NT_4.0#Option_Pack, it was subsequently included as a free component of Windows Server ....
. This is especially true if Perl module
Perl module

A Perl module is a discrete component of software for the Perl programming language. A module is distinguished by a unique namespace, e.g. "CGI" or "Net::FTP" or "XML::Parser" and a filename similarly named ....
s would need to be installed on the web host or if wanting to use a non-CGI environment that might require extra configurations on the web server. Some web hosts also rely on interpreter-level sandboxing
Sandbox (computer security)

In computer security, a sandbox is a security mechanism for safely running programs. It is often used to execute untested code, or untrusted programs from unverified third-parties, suppliers and untrusted users....
, which while possible with the , wouldn't be very practical and undoubtly break a lot of scripts considering common practices. Similar considerations might apply to other general-purpose scripting languages like Python
Python (programming language)

Python is a general-purpose high-level programming language. Its design philosophy emphasizes code readability. Python's core syntax and semantics are Minimalism , while the standard library is large and comprehensive....
 or Ruby
Ruby (programming language)

Ruby is a dynamic programming language, reflection , general purpose object-oriented programming language that combines syntax inspired by Perl with Smalltalk-like features....
. For these reasons, a lot of cheap web hosts nowadays effectively only support PHP and web developers often seek compatibility with them.

A modern Perl 5 CGI using the standard CGI module with a form similar to the one above might look like:

form_handler.pl
  1. !/usr/bin/perl
use CGI qw(:standard);

$user = param('user'); print header; print html( body( p("Hello, $user!"), ), );

Form-to-email scripts

Among the simplest and most commonly needed types of server-side script is that which simply emails the contents of a submitted form. This kind of script is frequently exploited by spammers, however, and many of the most popular form-to-email scripts in use are vulnerable to be hijacked for spamming purposes. One of the most popular scripts of this type was made by Matt's Script Archive. Today, no version of this still frequently used script is considered secure.

To avoid the confusion and difficulty of installing and using scripts, webmasters often use a free forms processing service to get their forms working.

See also

  • CAPTCHA
    CAPTCHA

    A CAPTCHA or Captcha is a type of challenge-response authentication test used in computing to ensure that the response is not generated by a computer....
  • XForms
    XForms

    XForms is an XML format for the specification of a data processing model for XML data and user interface for the XML data, such as form . XForms was designed to be the next generation of HTML / XHTML forms, but is generic enough that it can also be used in a standalone manner or with presentation languages other than XHTML to describe a user...
  • Postback
    Postback

    A Postback is an action taken by an interactive webpage, when the entire page and its contents are sent to the server for processing some information and then, the server posts the same page back to the browser....


External links

  • , the W3C's spec page for forms in HTML 4.