# Callback not returning the values for a dropdown menu

**URL:** <https://community.plotly.com/t/callback-not-returning-the-values-for-a-dropdown-menu/67735>\
**Category:** Dash Python\
**Created:** [September 7, 2022, 4:28pm UTC](https://community.plotly.com/t/callback-not-returning-the-values-for-a-dropdown-menu/67735 "2022-09-07T16:28:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![cl\_frp](https://avatars.discourse-cdn.com/v4/letter/c/a9adbd/32.png) [@cl\_frp](https://community.plotly.com/u/cl_frp)\
**Post date:** [September 7, 2022, 4:28pm UTC](https://community.plotly.com/t/callback-not-returning-the-values-for-a-dropdown-menu/67735/1 "2022-09-07T16:28:30Z")

</div>

Hello,

The script below does not display any values in the dropdown menu.  
I am trying to display values in the menu dynamically via callback as the dropdown values change depending on the value of the tab.

I have written an example code below that reproduces the error.

Could someone point me in the right direction please?

```auto
import pandas as pd
import numpy as np

from dash import Dash, dcc, html, Input, Output, callback
import dash_bootstrap_components as dbc
import plotly.express as px

app = Dash(external_stylesheets=[dbc.themes.BOOTSTRAP])

tabs_content = html.Div([
        dbc.Row(dbc.DropdownMenu(id = 'dpvars')),
        dbc.Row(dcc.Graph(id="graph1")),
        ])

app.layout = dbc.Container(
    [
        html.H1("Iris Dataset"),
        html.Hr(),
        dbc.Tabs(
            [
                dbc.Tab(label="Length", tab_id="length")
            ],
            id="tabs",
            active_tab="length",
        ),
        html.Div(id="tab-content", className="p-4"),
    ]
)

@app.callback(
    Output("tab-content", "children"),
    [Input("tabs", "active_tab")],
)

def render_tab_content(active_tab):

    if active_tab:
        if active_tab == "length":
            return tabs_content

@app.callback(Output("graph1", "figure"),
              Output("dpvars", "options"),
              Output("dpvars", "value"),
          [Input("tabs", "active_tab")])

def generate_graphs(active_tab):

    iris_df = pd.read_csv('https://raw.githubusercontent.com/mwaskom/seaborn-data/master/iris.csv')

    if active_tab == 'length':
        menu_list = ['length', 'petal']

    keep_cols = []
    for each_var in menu_list:
        keep_cols.append([col for col in iris_df.columns if each_var in col])
    keep_cols2 = [col for sublist in keep_cols for col in sublist]
    keep_cols2 = np.unique(keep_cols2).tolist()

    value = menu_list[0]

    df = iris_df[keep_cols2].copy()

    fig = px.line(df)

    return fig, [{"label": i, "value": i} for i in menu_list], value

if __name__ == " __main__":
    app.run_server()

```

---

<div class="post-metadata">

**Author:** ![trailboss](https://avatars.discourse-cdn.com/v4/letter/t/f14d63/32.png) [@trailboss](https://community.plotly.com/u/trailboss)\
**Post date:** [September 8, 2022, 5:54am UTC](https://community.plotly.com/t/callback-not-returning-the-values-for-a-dropdown-menu/67735/2 "2022-09-08T05:54:07Z")

</div>

Replace dbc.DropdownMenu with dbc.Select if you want to pass options like that.

Make sure to turn on debug mode when you are developing. There are a few other errors in there.

---

<div class="post-metadata">

**Author:** ![cl\_frp](https://avatars.discourse-cdn.com/v4/letter/c/a9adbd/32.png) [@cl\_frp](https://community.plotly.com/u/cl_frp)\
**Post date:** [September 8, 2022, 9:11pm UTC](https://community.plotly.com/t/callback-not-returning-the-values-for-a-dropdown-menu/67735/3 "2022-09-08T21:11:47Z")

</div>

Thank you so much, that solved the issue!  
Cecile
