Allow user add more textfield

Hello!

I’m trying to make a form that allow user add more than 1 textfield (“Type”) but maximal 5 textfield using “+” button. For now, I only can add 1 texfield

addForm.rp (56.8 KB)

There are several ways you could do this. Here is an updated file showing two different approaches. On Page 2 I show a “brute force” approach, in which I duplicated the hidden dynamic panel (dp), and named them all “Dynamic 1” through “Dynamic 5”. On each “add button” press, the “next” dp is shown and the “next next” dp is moved into place.

On Page 3 I show a more extensible approach using a repeater widget. Each “add button” press adds a new row to the repeater. Because it looks like you need the “Type” fields grouped together, above the “kg” field, I’ve added a repeater column to track the order of the rows and sort the repeater on this column each time a new row is added. The easiest way to keep track of how many “Type” fields exist is with a global variable (I named, “countType”). This may all seem more complicated–and the initial setup is–but it allows flexibility to easily change the number and type of input fields added, if say, someone decides you need to add only 3 extra fields, or 20 extra fields, instead of 5. Also, whatever visual styling and code you might want to assign to the input fields only has to be done once in the repeater, instead of 5 different places–on each copy of the input field.

addForm.rp (140.0 KB)

1 Like

Perfect! I really appreciate it. Thank You

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.