Black Lives Matter. Please consider donating to Black Girls Code today.

Gettiing all the values of checkbox

Hello,
I have checklist and a button in my form.When I select some checkboxes and click on button,I need to fetch all the selected values in my code.Which callback do I need to use?

You would use something like:

@app.callback(
    Output("my-output", "attribute"),
    [Input("my-button", "n_clicks")],
    [State("my-checklist", "value")]
)
def do_something(trigger, values):
    if trigger:
        # The button has been clicked, values is a list containing the active checklist values
        # do something with values
        # return something
    else:
        return dash.no_update
1 Like

What does the attribute in output refers to?

Worked fine.I used my own output in that place.Thanks