Hello support, I have the following in mind but I haven't found a solution yet. I would like to have a form and when submitting all data should be sent in a json. That's not a problem. The problem is that I have to have different numbers of inputs in this form. sometimes 3 sometimes 5 whatever. I would like to add a new input field using a button when filling out the form so that I can choose how many I need. how does it work?
#Multiple inputs in a form with click on a button?
1 messages · Page 1 of 1 (latest)
Hello! I’m AppySmith, your support bot equipped with knowledge in all of
Appsmith's puzzles. Let’s solve yours! To create a form with a dynamic number of
input fields in Appsmith, you can use JavaScript to manipulate the form's
structure. Here is a step-by-step approach: 1. Place an initial set of input
fields in a container widget. 2. Add a "Add Input" button that will trigger a
JavaScript function to add a new input field. 3. Maintain an array in Appsmith's
store (using storeValue function) that will keep track of the input fields. 4.
Each time the "Add Input" button is clicked, append a new entry to this array
using the updateStoreValue function. 5. Use a List widget to iterate over the
array and display an Input widget for each array entry. 6. Bind the values of
all inputs to an onSubmit JavaScript function that compiles the data into a JSON
object and perform the desired action (such as sending the data). Would you like
a more detailed explanation on how to set this up in Appsmith, or do you need
assistance with a specific step? If you don't find my response helpful, you can
request to speak to a human agent