I’m trying to use a for loop to iterate over a list of field names [fields] to create a series of text dcc.Inputs on consecutive rows. If I move the “for field in fields” line inside dbc.row it works fine but obviously will create inputs side by side. When outside dbc.Row (as in the below) it returns an error, in fact whenever I create any kind of for loop one level below the dbc.Container it creates an error. Is there a rookie mistake I’m making?
layout = html.Div([
dbc.Container([
dbc.Row([
dbc.Col([
dcc.Input(id='{}'.format(field), type='text', value='{}'.format(field))
])
]) for field in fields
])
])
Thank you in advance for any help you can provide.