Black Lives Matter. Please consider donating to Black Girls Code today.
Learn how to use COVID-19 data in open source Dash apps. Register for the Sept 23rd webinar with IQT!

Textarea Value Prop

How does one reference the content of a Textarea? I have a form with a required Textarea element and would like to enable the form submit button after a user has populated the Textarea, but it’s not clear in the ipython help what prop I should be referencing.

For example, the following doesn’t work because Textarea doesn’t have a value prop:

layout = html.Div([
  html.H2('Some Form'),
  html.Form(
    id='new-entry-form',
    children = [
        html.Label('Required Dropdown'),
        dcc.Dropdown(
           id='dropdown',
           options = dropdown_options,
        )
        html.Label('Required Text'),
        html.Textarea(
          id='textarea',
          placeholder='You must enter some text here.',
        )
        html.Button(
          id='form-submit',
          type='submit',
          children=['Submit']
        )
    ]
  )
])

@app.callback( 
  dd.Output('form-submit', 'disabled'),
  inputs=[
    dd.Input('dropdown', 'value'),
    dd.Input('Textarea', 'value'),
])
def enable_submit(dropdown_value, textarea_value):
  if dropdown_value is None or textarea_value is None:
    return True
  else:
    return False
1 Like

Textarea isn’t editable right now. I’ll add that to the list though and update this issue when it gets added to dash_core_components.

2 Likes

FYI, dcc.Textarea is working as expected in the latest release!

dcc.Textarea(
    id='text-input',
    placeholder='You must enter some text here.',
)
1 Like