# Single input updating multiple paired components

**URL:** <https://community.plotly.com/t/single-input-updating-multiple-paired-components/49140>\
**Category:** Dash Python\
**Created:** [January 19, 2021, 3:33pm UTC](https://community.plotly.com/t/single-input-updating-multiple-paired-components/49140 "2021-01-19T15:33:19Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![gv-collibris](https://avatars.discourse-cdn.com/v4/letter/g/34f0e0/32.png) [@gv-collibris](https://community.plotly.com/u/gv-collibris)\
**Post date:** [January 19, 2021, 3:33pm UTC](https://community.plotly.com/t/single-input-updating-multiple-paired-components/49140/1 "2021-01-19T15:33:19Z")

</div>

Hi all,  
I’m looking for a way to let 1 Input update the options of several dropdowns. I’ve come up with the following code:

```auto
@app.callback(
    Output({"id": PREFIX, "name": MATCH}, 'options'),
    Output({"id": PREFIX, "name": MATCH}, 'value'),
    Input({"id": PREFIX, "role": "update"}, 'value'),
    State({"id": PREFIX, "name": MATCH}, 'options'),
    State({"id": PREFIX, "name": MATCH}, 'value'))
def update_dropdown(update, initial_options, initial_value):
    if update == 1:
        ...
        return new_options, new_value
    return initial_options, initial_value

```

However, my callback is never triggered. I feel like it’s due to the Input not having the `MATCH` keyword.  
One alternative would be to use the `ALL` keyword, but then I would have to match inputs and states for options and values by hand, which might be tedious…

Any thought on this ?

---

<div class="post-metadata">

**Author:** ![Eduardo](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/eduardo/32/13310_2.png) [@Eduardo](https://community.plotly.com/u/Eduardo)\
**Post date:** [January 19, 2021, 6:12pm UTC](https://community.plotly.com/t/single-input-updating-multiple-paired-components/49140/2 "2021-01-19T18:12:33Z")

</div>

I do not understand your Input, normal way is ‘id’ and ‘property’.

---

<div class="post-metadata">

**Author:** ![gv-collibris](https://avatars.discourse-cdn.com/v4/letter/g/34f0e0/32.png) [@gv-collibris](https://community.plotly.com/u/gv-collibris)\
**Post date:** [January 20, 2021, 8:42am UTC](https://community.plotly.com/t/single-input-updating-multiple-paired-components/49140/3 "2021-01-20T08:42:12Z")

</div>

Hi Eduardo,  
`Input` takes two arguments : `component_id` and `component_property`.  
Usually, both are strings, but you can put whatever you want as `component_id`  
Also, given the pattern-matching callback context, a dictionary as `component_id` is the way to go to allow a matching on a part of the `component_id`.

---

<div class="post-metadata">

**Author:** ![gv-collibris](https://avatars.discourse-cdn.com/v4/letter/g/34f0e0/32.png) [@gv-collibris](https://community.plotly.com/u/gv-collibris)\
**Post date:** [January 20, 2021, 5:23pm UTC](https://community.plotly.com/t/single-input-updating-multiple-paired-components/49140/4 "2021-01-20T17:23:20Z")

</div>

My bad, the `Input` was wrong:

```auto
@app.callback(
    Output({"id": PREFIX, "name": MATCH}, 'options'),
    Output({"id": PREFIX, "name": MATCH}, 'value'),
    Input({"id": "correct value (not PREFIX)", "role": "update"}, 'value'),
    State({"id": PREFIX, "name": MATCH}, 'options'),
    State({"id": PREFIX, "name": MATCH}, 'value'))
def update_dropdown(update, initial_options, initial_value):
    if update == 1:
        ...
        return new_options, new_value
    return initial_options, initial_value

```

works just fine
