Wolfram Language & System 10.4 (2016)|Legacy Documentation

This is documentation for an earlier version of the Wolfram Language.View current documentation (Version 11.2)

This feature relies on access to Wolfram Cloud.

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 interpreted as types .

uses as the label for the field named .

uses as the default for the field specified by .

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

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

Details and OptionsDetails and Options

  • FormFunction[formspec,func] displays the form specified by formspec, together with a "submit" button.
  • 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.
  • Overall options for FormFunction include:
  • AppearanceRulesAutomaticassociation giving overall appearance rules
    FormLayoutFunctionAutomaticfunction to generate layout for the form
    FormThemeAutomaticoverall theme to use for the form
    ImageFormattingWidth$ImageFormattingWidthwrapping width for output formatting
    ImageSizeAutomaticoverall image size for output
  • 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
    "HTMLCloudCDF"pure HTML with CloudCDF if needed
    "CloudCDF"CloudCDF 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.
  • In multipage forms represented by FormFunction[{formspec1,formspec2,},], the successive forms specified by the 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 after are typically always pure functions. They are applied to an association giving the values of all inputs obtained from all earlier .

ExamplesExamplesopen allclose all

Basic Examples  (2)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
Introduced in 2014