Listing of Field Types »


represents an active form that, when submitted, applies func to the values obtained from the form specified by formspec.


represents an active form with fields named namei interpreted as types typei.


uses labeli as the label for the field named namei.


uses defaulti as the default for the field specified by namespeci.


specifies that in the cloud, the result from applying func should be returned in format fmt.


represents a multipage form, in which the successive formspeci can be functions that are applied to the values obtained so far.

Details and Options

  • FormFunction[formspec,func] displays the form specified by formspec, together with a "submit" button.
  • In FormFunction[formspec,func], formspec can be FormObject[].
  • FormFunction[formspec,func] evaluates to give FormFunction[FormObject[],func], where the FormObject contains full specifications for all fields in the form.
  • CloudDeploy[FormFunction[]] yields a cloud object containing an active version of the form.
  • FormFunction[formspec,func][] evaluates by first evaluating Setting[formspec] to give an association of values for fields in the form. If no validation errors are generated, func is applied to the association, and the result is returned.
  • FormFunction[formspec,func][<|"namek"->inputk,|>] inserts the inputs given into the form specified by FormFunction before evaluating the effect of the FormFunction.
  • FormFunction[][] evaluates to an active form, which, assuming it has valid input given, is replaced by the result from applying func when it is submitted.
  • The typei for each field can be any of the following:
  • "form"any form supported by Interpreter
    Restricted[], etc.any restricted form etc. supported by Interpreter
    Interpreter[]any Interpreter object
    assocan association as used in FormObject
    tfunany function to be applied to the string
  • In multipage forms represented by FormFunction[{formspec1,formspec2,},], the successive forms specified by the formspeci are displayed, with the last form by default having a "done" button, and earlier forms by default having "next" buttons.
  • In FormFunction[{formspec1,formspec2,},], the formspeci after formspec1 are typically always pure functions. They are applied to an association giving the values of all inputs obtained from all earlier formspeci.
  • Overall options for FormFunction include:
  • AppearanceRulesAutomaticassociation giving overall appearance rules
    FormLayoutFunctionAutomaticfunction to generate layout for the form
    ImageFormattingWidth$ImageFormattingWidthwrapping width for output formatting
    ImageSizeAutomaticoverall image size for output
    PageThemeAutomaticoverall theme to use for the deployed web page
  • When called in the cloud, FormFunction[formspec,func] by default returns the result in a format suitable for web output.
  • Possible result specifications fmt in FormFunction[formspec,func,fmt] are:
  • Automaticexport as HTML or CloudCDFElement as appropriate
    "HTML"export as raw static HTML page without dynamic content
    "HTMLThemed"export as static HTML using the same theme as the form
    "HTMLPaneled"export as HTML content in a panel
    "CloudCDF"CDF with interactive components in the cloud
    "CloudCDFElement"embeddable interactive CDF element in the cloud
    "GIF","JPEG","PNG",image of the result
    "String"raw string form of the result
    "fmt"any format supported by ExportForm
    Nonepass a string or list of bytes through without change
    {None,"type"}pass through, with a specific HTTP response type defined
    {fmt,opts}format specification with options
    fan arbitrary function to be applied to body
  • When called in the cloud, FormFunction[formspec,func,"fmt"] is equivalent to FormFunction[formspec,ExportForm[func[#],"fmt"]&].
  • When called directly in the notebook interface, the result specification fmt in FormFunction[formspec,func,fmt] is ignored.


open all close all

Basic Examples  (2)

Set up a form function:

Click for copyable input

Activate it, then fill in inputs:

Click for copyable input

Deploy the form function to the cloud:

Click for copyable input

Programmatically fill in the form:

Click for copyable input

A partially submitted form will not be activated:

Click for copyable input

Create dynamic forms:

Click for copyable input

Scope  (28)

Options  (6)

Applications  (2)

Properties & Relations  (8)

Possible Issues  (1)

Neat Examples  (2)

Introduced in 2014
Updated in 2015