# JSDoc: Class: Form

# Class: Form

## visual.Form(options)

#### new Form(options)

Form stimulus.

##### Parameters:

Name | Type | Description
--- | --- | ---

`options`

Object

###### Properties

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`name` | String |  |  | the name used when logging messages from this stimulus
`win` | module:core.Window |  |  | the associated Window
`pos` | Array.<number> | <optional> | [0, 0] | the position of the center of the slider
`size` | Array.<number> |  |  | the size of the slider, e.g. [1, 0.1] for an horizontal slider
`units` | string | <optional> | 'height' | the units of the Slider position, and font size
`color` | Color | <optional> | Color('LightGray') | the color of the slider
`contrast` | number | <optional> | 1.0 | the contrast of the slider
`opacity` | number | <optional> | 1.0 | the opacity of the slider
`depth` | number | <optional> | 0 | the depth (i.e. the z order), note that the text, radio buttons and slider elements are at depth + 1
`items` | Array.<number> | <optional> | [] | the array of labels
`itemPadding` | number | <optional> | 0.05 | the granularity
`font` | string | <optional> | 'Arial' | the text font
`fontFamily` | string | <optional> | 'Helvetica' | the text font
`bold` | boolean | <optional> | true | whether or not the font of the labels is bold
`italic` | boolean | <optional> | false | whether or not the font of the labels is italic
`fontSize` | number | <optional> |  | the font size of the labels (in form units), the default fontSize depends on the Form units: 14 for 'pix', 0.03 otherwise
`clipMask` | PIXI.Graphics | <optional> | null | the clip mask
`autoDraw` | boolean | <optional> | false | whether or not the stimulus should be automatically drawn on every frame flip
`autoLog` | boolean | <optional> | false | whether or not to log

Mixes In:
  - module:util.ColorMixin
Source:
  - visual/Form.js, line 21

### Extends

- module:visual.VisualStim

### Members

#### contains

Determine whether an object is inside the bounding box of the stimulus.

Overrides:
  - module:visual.VisualStim#contains
Source:
  - visual/VisualStim.js, line 184

#### setOri

Setter for the orientation attribute.

Inherited From:
  - module:visual.VisualStim#setOri
Source:
  - visual/VisualStim.js, line 133

#### setPos

Setter for the position attribute.

Inherited From:
  - module:visual.VisualStim#setPos
Source:
  - visual/VisualStim.js, line 161

#### setSize

Setter for the size attribute.

Inherited From:
  - module:visual.VisualStim#setSize
Source:
  - visual/VisualStim.js, line 105

### Methods

#### (protected) _estimateBoundingBox()

Estimate the bounding box.

Overrides:
  - module:visual.VisualStim#_estimateBoundingBox
Source:
  - visual/Form.js, line 681

#### (protected) _onChange(withPixiopt, withBoundingBoxopt) → {function}

Generate a callback that prepares updates to the stimulus. This is typically called in the constructor of a stimulus, when attributes are added with _addAttribute.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`withPixi` | boolean | <optional> | false | whether or not the PIXI representation must also be updated
`withBoundingBox` | boolean | <optional> | false | whether or not to immediately estimate the bounding box

Inherited From:
  - module:visual.VisualStim#_onChange
Source:
  - visual/VisualStim.js, line 266

##### Returns:

Type
  function

#### addDataToExp(experiment, formatopt)

Add the form data to the given experiment.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`experiment` | module:data.ExperimentHandler |  |  | the experiment into which to insert the form data
`format` | string | <optional> | 'rows' | whether to insert the data as rows or as columns

Source:
  - visual/Form.js, line 408

#### draw()

Overridden draw that also calls the draw method of all form elements.

Source:
  - visual/Form.js, line 245

#### formComplete() → {boolean}

Check if the form is complete.

Source:
  - visual/Form.js, line 394

##### Returns:

- whether there are any remaining incomplete responses.

Type
  boolean

#### getData() → {object}

Collate the questions and responses into a single dataset.

Source:
  - visual/Form.js, line 348

##### Returns:

- the dataset with all questions and responses.

Type
  object

#### hide()

Overridden hide that also calls the hide method of all form elements.

Source:
  - visual/Form.js, line 285

#### refresh()

Force a refresh of the stimulus.

Overrides:
  - module:visual.VisualStim#refresh
Source:
  - visual/Form.js, line 221

#### reset()

Reset the form.

Source:
  - visual/Form.js, line 321