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

Remove checkboxes based on deselected checkboxes

basically I want to be able to create a new set of checkboxes based on a previous set. This is to give user flexibility in moving back and forth. I basically create a set of checkboxes based on selection from (checklist). Then I want to create another set based on the deselection of the new. But I am not able to use the State function for checklist 2?

@app.callback(Output(‘ch1’, ‘children’),

def update_output(clicks, val):

if clicks > -1:
    for q in val:
        if q not in selq:
                id = 'checklist2',
                options= [
                {'label': Q, 'value': Q} for Q in selq

@app.callback(Output(‘ch2’, ‘children’),
def new1(abc,val2):
if abc>-1:
for a in val2:
if a not in selq1:
id = ‘checklist3’,
options= [
{‘label’: A, ‘value’: A} for A in selq1

Check out the example under “multiple outputs” here:

Rather than remaking the checklist, you can simply change the options based on another checklist.