Form - Dynamically utilize an Unknown Number of Inputs

Hello All,

I am creating a form inside of my dashboard where the user can add a wide range of custom constraints. Each set of constraints has two-three required inputs. Each “constraint” has its own row with three input boxes, but there is a button which allows the users to add a new row. There could theoretically be an infinite number of rows, as they are just generated based on the n_click count from the button. The callback function which generates the total rows also dynamically generates the ids associated with each input box by adding a suffix “_{i}” for i in range(0, n_clicks).

The problem I am running into is adding these input constraints into the final callback. I am stuck with something like:

     Output(component_id = 'submit-response', component_property = 'children'), 
     [Input(component_id = f'constraint_{i}',   component_property = 'value') for i in range(0, n)] +
     [Input(component_id = f'constraint_two_{i}',   component_property = 'value') for i in range(0, n)] + 
     [Input(component_id = f'constraint_three_{i}',   component_property = 'value') for i in range(0, n)])
def final_callback(?????):
      do stuff:

What is the best way to handle this type of situation?

Check out pattern matching callbacks :slightly_smiling_face: