.. _dijit/form/TextBox: dijit.form.TextBox ================== :Status: Draft :Version: 1.3 :Authors: Becky Gibson, Doug Hays, Bill Keese, Nikolai Onken, Marcus Reimann, Craig Riecke :Developers: Doug Hays, Bill Keese :Available: since V1.0 .. contents:: :depth: 2 TextBox is a basic -style form control. It has rudimentary text-scrubbing functions that trim or proper-casify text, but it does not validate the entered text. Like all Dijit controls, TextBox inherits the design theme, so it's better to use this than an HTML control, even if you don't have to do any input scrubbing. However: * If the input is a number, use :ref:`dijit.form.NumberTextBox ` or :ref:`dijit.form.NumberSpinner `. These boxes ensure only digits, decimal points and group separators (specific to the locale) are entered. * If the input is currency, use :ref:`dijit.form.CurrencyTextBox ` instead. * If the input is a date, use :ref:`dijit.form.DateTextBox ` which validates date input according to the locale, and adds a little pop-up calendar for easy selection. * If the input is a time, use :ref:`dijit.form.TimeTextBox ` which features a scrolling day-planner-like time chooser. * If the input is a list of values, use :ref:`dijit.form.FilteringSelect `. If you'd like to include free-form values too, use :ref:`dijit.form.ComboBox `. These two look like Sizing TextBoxes ---------------- Sizing a text box is done through the CSS width on the text box dom node. Typically this is done by specifying the width in ems. Please see the following for an example: .. cv-compound :: .. cv :: javascript .. cv :: html A default textbox:

A large textbox:

A small textbox:

A programmatically sized textbox:

.. cv:: css Getting and Manipulating the Value ---------------------------------- Getting and manipulating the value is a trivial matter. It is done through the attr() function of the widget. Please see the following example for more detail: .. cv-compound :: .. cv :: javascript .. cv :: html A textbox with a value:
A textbox set with a value from the above textbox:
.. cv:: css ============= Accessibility ============= Keyboard -------- The TextBox widget uses native HTML INPUT (type=text) controls.