Login Register

Form, Validation, Specialized Input

The following widgets can be used in a FORM tag, in a dijit.form.Form widget, or outside of a form.

All form widgets implement the following attributes and methods. Many of them act as "shadow" attributes for their HTML counterparts, as in "name" or "id".

dijit.form._FormWidget
Base class for all form widgets - that is, all widgets beginning with "dijit.form"
Attributes
disabled Boolean Should this widget respond to user input? In markup, this is specified as "disabled='disabled'", or just "disabled". Use setAttribute("disabled", true/false) to change after creation time.
intermediateChanges Boolean If true, trigger an onChange event every time setValue is called. If false, trigger onChange only when asked by the callee. For example, on Slider a true value would fire onChange events at each point of the mouse drag. False would trigger onChange only on mouseUp.
tabIndex Integer Order fields are traversed when user hits the tab key
Methods
focus Set the focus on this widget
getValue get the value of the widget.
setValue set the value of the widget.
reset resets the widget to it's initial value
undo restore the value to the last value passed to onChange

Changed in 1.1

setAttribute Controls all sorts of attributes for widgets like disabled, readonly, etc. The exception is value, which is generally still controlled via setValue()/getValue(). Methods like setDisabled() have been deprecated.
Extension Points
onChange callback when value is changed

CheckBox, RadioButton checkbox.png
ComboBox combo_box.png
CurrencyTextBox currency_textbox.png
DateTextBox date_textbox.png
FilteringSelect filtering_select.png
InlineEditBox (0.9) For 1.0, see dijit.InlineEditBox inline_edit.png
NumberSpinner number_spinner.png
NumberTextBox number_textbox.png
Slider slider.png
Textarea Textarea expands to fit content textarea.png
TextBox textbox.png
TimeTextBox time_textbox.png
ValidationTextBox validating_textbox.png

name attribute neglected

The name attribute isn't mentioned above. Also, alt,id,value,baseClass, and type aren't listed.

Not Neglected So Much As...

... unnecessary. All of these except baseClass are HTML attributes, and using them does not cause any unexpected behavior. Id is a special case covered by the Common Features page. And baseClass should not be set by Dijit users.

DateTextBox getValue and setValue not valid 0.9 methods?

From what I can tell from the following:

http://dojotoolkit.org/book/dojo-porting-guide-0-4-x-0-9/widgets/datepic...

getValue and setValue are not valid methods for the DateTextBox anymore. This also seems to be true for the ColorPallete as well based on:

http://dojotoolkit.org/book/dojo-porting-guide-0-4-x-0-9/widgets/colorpa...

Although, it is not as definitive for this widget based on the information provided at the above link.

So the above description of methods is somewhat confusing, since it seems to imply that these two methods apply to all dijit.form widgets.

-=> Gregg <=-

TODO: document onChange per widget

Need more documentation about onChange().

For simple widgets it's called as onChange(value).

For widgets like slider and spinner, as of the 1.1 release it's called as onChange(value, intermediateChange) (see #4958 for details).

And of course for checkbox and radio type widgets (including ToggleButton) it reports changes to the checked state, not to the value of the widget.

Form Navigation in Dijit?

Is there a Navigation Manager in Dijit so that developers have a facility to control the focus among widgets inside a form?

If i have an input form with lots of input textboxes and combo boxes, how do I control which widget to get the next focus when I press Enter key or the TAB key from the previous widget?

tabIndex

Just use tabIndex. You can google for it; it's a standard HTML attribute.

IE7 Links

The links to the individual widgets seem broken in IE7. Works ok in FF2.

Message: Internet Explorer cannot go to the site: URL - Operation Aborted.

Josh