Tethys Platform
Table Of Contents
Table Of Contents

Text Input

Last Updated: August 10, 2015

class tethys_sdk.gizmos.TextInput(name, display_text='', initial='', placeholder='', prepend='', append='', icon_prepend='', icon_append='', disabled=False, error='', attributes={}, classes='')

The text input gizmo makes it easy to add text inputs to your app that are styled similarly to the other input snippets.

display_text

Display text for the label that accompanies select input

Type

str

name

Name of the input element that will be used for form submission

Type

str, required

initial

The initial text that will appear in the text input when it loads

Type

str

placeholder

Placeholder text is static text that displayed in the input when it is empty

Type

str

prepend

Text that is prepended to the text input

Type

str

append

Text that is appended to the text input

Type

str

icon_prepend

The name of a valid Bootstrap v2.3 icon. The icon will be prepended to the input.

Type

str

icon_append

The name of a valid Bootstrap v2.3 icon. The icon will be appended to the input.

Type

str

disabled

Disabled state of the select input

Type

bool

error

Error message for form validation

Type

str

attributes

A dictionary representing additional HTML attributes to add to the primary element (e.g. {"onclick": "run_me();"}).

Type

dict

classes

Additional classes to add to the primary HTML element (e.g. "example-class another-class").

Type

str

Controller Example

from tethys_sdk.gizmos import TextInput

text_input = TextInput(display_text='Text',
                       name='inputAmount',
                       placeholder='e.g.: 10.00',
                       prepend='$')

text_error_input = TextInput(display_text='Text Error',
                             name='inputEmail',
                             initial='bob@example.com',
                             disabled=True,
                             icon_append='glyphicon glyphicon-envelope',
                             error='Here is my error text')

context = {
            'text_input': text_input,
            'text_error_input': text_error_input,
          }

Template Example

{% gizmo text_input %}
{% gizmo text_error_input %}