dijit/form/_FormMixin (version 1.10)

Summary

Mixin for containers of form widgets (i.e. widgets that represent a single value and can be children of a <form> node or dijit/form/Form widget)

Can extract all the form widgets values and combine them into a single javascript object, or alternately take such an object and set the values for all the contained form widgets

See the dijit/form/_FormMixin reference documentation for more information.

Property Summary

  • stateWill be &quot;Error&quot; if one or more of the child widgets has an invalid value, &quot;Incomplete&quot; if not all of the required child widgets are filled in.

Method Summary

  • _getDescendantFormWidgets(children) Returns all form widget descendants, searching through non-form child widgets like BorderContainer
  • _getState() Compute what this.state should be based on state of children
  • _getValueAttr() Returns Object representing form values.
  • _setValueAttr(obj) Fill in form values from according to an Object (in the format returned by get('value'))
  • connectChildren(inStartup) You can call this function directly, ex. in the event that you programmatically add a widget to the form after the form has been initialized.
  • destroy()
  • disconnectChildren() Deprecated method.
  • getValues()
  • isValid() Returns true if all of the widgets are valid.
  • reset()
  • setValues(val)
  • startup()
  • validate() returns if the form is valid - same as isValid - but provides a few additional (ui-specific) features: it will highlight any sub-widgets that are not valid it will call focus() on the first invalid sub-widget

Event Summary

  • _onChildChange(attr) Called when child's value or disabled state changes
  • onValidStateChange(isValid) Stub function to connect to if you want to do something (like disable/enable a submit button) when the valid state changes on the form as a whole.

Properties

state
Defined by: dijit/form/_FormMixin

Will be "Error" if one or more of the child widgets has an invalid value, "Incomplete" if not all of the required child widgets are filled in. Otherwise, "", which indicates that the form is ready to be submitted.

Methods

_getDescendantFormWidgets(children)

Returns all form widget descendants, searching through non-form child widgets like BorderContainer

Parameter Type Description
children dijit/_WidgetBase[]
Optional
Returns:Array
_getState()

Compute what this.state should be based on state of children

Returns:string
_getValueAttr()

Returns Object representing form values. See description of value for details.

Returns:object
_setValueAttr(obj)

Fill in form values from according to an Object (in the format returned by get('value'))

Parameter Type Description
obj Object
connectChildren(inStartup)

You can call this function directly, ex. in the event that you programmatically add a widget to the form after the form has been initialized.

Parameter Type Description
inStartup Boolean
destroy()
disconnectChildren()

Deprecated method. Applications no longer need to call this. Remove for 2.0.

getValues()
Returns:undefined
isValid()

Returns true if all of the widgets are valid. Deprecated, will be removed in 2.0. Use get("state") instead.

Returns:boolean
reset()
setValues(val)
Parameter Type Description
val undefined
Returns:undefined
startup()
validate()

returns if the form is valid - same as isValid - but provides a few additional (ui-specific) features:

  1. it will highlight any sub-widgets that are not valid
  2. it will call focus() on the first invalid sub-widget
Returns:undefined

Events

_onChildChange(attr)
Defined by: dijit/form/_FormMixin

Called when child's value or disabled state changes

Parameter Type Description
attr String
onValidStateChange(isValid)
Defined by: dijit/form/_FormMixin

Stub function to connect to if you want to do something (like disable/enable a submit button) when the valid state changes on the form as a whole.

Deprecated. Will be removed in 2.0. Use watch("state", ...) instead.

Parameter Type Description
isValid Boolean
Error in the documentation? Can’t find what you are looking for? Let us know!