Wolfram 语言与系统 10.0 (2014)|旧版文档

此为更早版本的 Wolfram 语言文档查看最新文档(版本11.2)


represents a form with fields having names that take data of type .

uses as the label for the field named .

uses full specification for a field, and as part of the layout of the form.


  • FormObject[] displays in a notebook interface as a form with fields that can be filled in, either by entering text or using other controls.
  • FormObject can be used to specify the structure of a form in FormFunction.
  • When evaluated, FormObject[] is converted to FormObject[fields], in which each entry in fields has a full specification of the form . The elements of the full specification include:
  • "Input"the raw input, if any, for the field (often a string)
    "Interpreter"the interpreter to be used for the field
    "Required"whether input is required for the field
    "Default"a default value, if any, for the field
    "Control"the type of control to provide for the field
    "Label"a label to display for the field
    "Hint"a hint to display for the field
    "Masked"whether to mask input given in the field
    "Help"help to associate with the field
  • Setting[FormObject[]] gives an association of the form , where the are the values obtained by interpreting the element associated with each according to the associated with the .
  • If is missing, or fails, then the value of is a Failure object.
  • FormObject[][<|"name1"->input1,|>] yields a FormObject[] in which the corresponding to each of the included has been replaced with .
  • FormObject[{FormObject[],}] yields a single FormObject[] corresponding to a combined form.
  • In FormObject[{,objj,}] the can be Delimiter, representing a horizontal delimiter.
  • They can also be expressions with heads Style, Row, Item, Text, ExpressionCell, and TextCell, as well as views and layout constructs such as TabView and Grid.
  • In FormObject[{"name1"->type1,}] the are used to give values for in the full specification.
  • Possible forms of type specifications are:
  • "form"any form supported by Interpreter
    Restricted[],etc.any restricted form etc. supported by Interpreter
    Interpreter[]any complete Interpreter object
    tfunany function to be applied to the raw input
  • If only is given, without a rule giving , then the interpreter is assumed to be Identity, so that the value is exactly whatever is given as the corresponding element.
  • Possible controls given as the value associated with include InputField, Slider, RadioButtonBar, and SetterBar.
  • Overall options for FormObject include:
  • AppearanceRulesAutomaticassociation giving overall appearance rules
    FormLayoutFunctionAutomaticfunction to generate final layout for the form
    FormThemeAutomaticoverall theme to use for the form
  • Typical elements in the setting for AppearanceRules include:
  • "Title"Noneoverall title for the form
    "Description"Nonedescription to include at the top of the form
    "RequiredFieldIndicator"Noneindicator to show required fields
    "SubmitButton""Submit"text or appearance function for the submit button


基本范例  (3)基本范例  (3)

Create an unfilled form:

Click for copyable input
Click for copyable input

Specify inputs for the form as strings:

Click for copyable input

Find the inputs that have been provided for the form:

Click for copyable input

The number has been parsed to an explicit number:

This input given for the second field cannot be parsed to a number, so a message is shown:

Click for copyable input

The setting contains a symbolic failure object:

Click for copyable input