Chaned callbacks dropdown and textarea

Hello,

I want to have a dropdown and textearea value in a function but I have some errors:

layout = html.Div([
    dbc.Row(title),
    dcc.Dropdown(all_tables, 'report', id='dropdown-table', multi=True, placeholder="Select a source"),
    html.Br(),
    dcc.Textarea(
        id='hosts-list',
        value='',
        style={'width': '100%', 'height': 200},
    ),
    html.Br(),
    html.Button('Search', id='button', n_clicks=0, className='btn-primary'),
    html.Br(),
    html.Div(id='table-output', style={'whiteSpace': 'pre-line'})
])

@callback(
     Output('dropdown-table', 'options'),
     Output('dropdown-table', 'value'),
     Input('hosts-list', 'value')
 )

def update_data(tables_value):
    
    if not tables_value:
        raise PreventUpdate

    return tables_value

@callback(
    Output('table-output', 'children'),
    Input('dropdown-table', 'value'),
    Input('hosts-list', 'value'),
    
)

def update_data(tables_value, hosts_value):

   
    return f'You have selected {hosts_value} and {tables_value}'

the erros taht I have:

dash._grouping.SchemaTypeValidationError: Schema: [<Output dropdown-table.options>, <Output dropdown-table.value>]
Path: ()
Expected type: (<class ‘tuple’>, <class ‘list’>)
Received value of type <class ‘str’>:
‘test’

the dropdown is there to get the user choice and textearea will be used as a hosts list, then I need to do some queries to generate the output

Any ideas?

Hi, wrap your return value in a list – > [ ]

in fact I have the error message when I type text into textarea:

dash._grouping.SchemaTypeValidationError: Schema: [<Output dropdown-table.options>, <Output dropdown-table.value>]
Path: ()
Expected type: (<class ‘tuple’>, <class ‘list’>)
Received value of type <class ‘str’>:
‘test’

The next step would be to implement a button, when I Click I get back the dropdown value and textarea value and process

This callback has two Output() but you are returning only one value which seems to be a string. You need to return two values.

try:

return tables_value, []