How can I get the output of dynamically created input boxes into another div?
You should probably give more details, and it is also a good practice to explain what you have tried. The answer to the previous post is the only way to do it if the output component is the same for all inputs (due to hard constraints by Dash). I tried it myself, and there was also a github issue about this specific thing (often pointing to solutions involving loops and hidden stuff) and another about being able to use regex patterns in callback definition (not yet closed). But maybe something was fixed in 1.0.0 and our own benevolent dictator can tell us more.
The output components will not be the same, as there are a dynamic number of inputs.
Then it is easy to create them in another callback. Here’s some pseudo-code where you click a button and it appends a new H4 to the children of some div:
app.layout = [ # stuff ... html.Div(id="main_div"), html.Button(id="add_more"), ] @app.callback(Output("main_div", "children"), # maybe more inputs [Input("add_more", "n_clicks")], # maybe more states [State("main_div", "children")]) def add_child(n_clicks, ..., current_children): new_child = html.H4("I can also be a Div with whatever inside") current_children.append(new_child) return current_children
Thank you for the reply. I should add that creating dynamic outputs is not an issue. The issue is accessing these dynamically created output values
Thank you for this link, I’ll give it a good read.