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