Class Index | File Index

Classes


Class MochiKit.Widget.Form


Extends MochiKit.Widget.
The form widget class. Provides a grouping for form fields, using the <form> HTML element. The form widget supports form reset, validation and data retrieval.
Defined in: Widget.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
Creates a new form widget.
Fields borrowed from class MochiKit.Widget:
_id, Classes
Method Summary
Method Attributes Method Name and Description
 
Handles the form submit signal.
 
Returns a map with all child DOM nodes containing form fields with a name attribute.
 
Returns an array with all child DOM nodes containing form fields.
 
Resets all fields in the form to their default values.
 
update(values)
Updates the fields in this form with a specified map of values.
 
Validates this form using the form validators found.
 
Resets all form validators.
 
Returns an array with all child DOM nodes containing form validator widgets.
 
Returns a map with all form field values.
Methods borrowed from class MochiKit.Widget:
_animQueueId, _createWidgetTreeElem, _eventHandler, _widgetMixin, addAll, addChildNode, addClass, animate, blurAll, createWidget, createWidgetTree, destroy, destroyWidget, emitSignal, getChildNodes, hasClass, hide, isFormField, isHidden, isWidget, removeAll, removeChildNode, removeClass, setAttrs, setStyle, show, toggleClass
Class Detail
MochiKit.Widget.Form(attrs)
Creates a new form widget.
Parameters:
{Object} attrs
the widget and node attributes
{Object} ... Optional
the child widgets or DOM nodes
Returns:
{Widget} the widget DOM node
Method Detail
_handleSubmit(evt)
Handles the form submit signal.
Parameters:
{Event} evt
the MochiKit.Signal.Event object

{Object} fieldMap()
Returns a map with all child DOM nodes containing form fields with a name attribute. If multiple fields have the same name, the returned map will contain an array with all matching fields.
Returns:
{Object} the map of form field elements

{Array} fields()
Returns an array with all child DOM nodes containing form fields. The child nodes will be returned based on the results of the MochiKit.Widget.isFormField() function.
Returns:
{Array} the array of form field elements

reset()
Resets all fields in the form to their default values.

update(values)
Updates the fields in this form with a specified map of values. If multiple fields have the same name, the value will be set to all of them.
Parameters:
{Object} values
the map of form field values

{Boolean/MochiKit.Async.Deferred} validate()
Validates this form using the form validators found.
Returns:
{Boolean/MochiKit.Async.Deferred} true if the form validated successfully, false if the validation failed, or a MochiKit.Async.Deferred instance if the validation was deferred

validateReset()
Resets all form validators.

{Array} validators()
Returns an array with all child DOM nodes containing form validator widgets.
Returns:
{Array} the array of form validator widgets

{Object} valueMap()
Returns a map with all form field values. If multiple fields have the same name, the value will be set to an array of all values. Any unchecked checkbox or radiobutton will be also be ignored.
Returns:
{Object} the map of form field values

Documentation generated by JsDoc Toolkit 2.0.2 on Sun May 24 2009 13:14:16 GMT+0200 (CEST)