Dynamically generating multiple input fields via Umbraco Heartcore
I'm currently creating a form using Umbraco Heartcore and fetching all the form fields using the REST APIs to my frontend (React). However, one of the objectives is to create a question that takes in a number which would in turn dynamically create more input fields (questions) based on the number provided.
This example above illustrates what I'm trying to achieve. I have the first question "How many children do you have (if any)?", if the user inputs 2 I expect the "Child Name" input to conditionally appear twice, however it only appears once at the moment.
Is it possible to dynamically generate multiple input fields based on user input from previous questions?
Dynamically generating multiple input fields via Umbraco Heartcore
I'm currently creating a form using Umbraco Heartcore and fetching all the form fields using the REST APIs to my frontend (React). However, one of the objectives is to create a question that takes in a number which would in turn dynamically create more input fields (questions) based on the number provided.
This example above illustrates what I'm trying to achieve. I have the first question "How many children do you have (if any)?", if the user inputs 2 I expect the "Child Name" input to conditionally appear twice, however it only appears once at the moment.
Is it possible to dynamically generate multiple input fields based on user input from previous questions?
Hey Ben.
It's not possible to generate extra fields in a Form using an e.g. POST request, however, there's a workaround that I think could work for you.
Change the "How many children" question to a dropdown and add a few values.
Then add several Form fields with conditions as shown below.
Let's say you want to have the dropdown with answers that range from 1 to 5.
The first field will have 5 conditions like "dropdown is 1,2,3,4,5"
The second field would have 4 conditions like "dropdown is 2,3,4,5" and so on.
Hope this helps :)
Best, Darek
is working on a reply...