Hi Atlassian Community,
I'm currently working on a project in Jira where I need to create a dynamic form that can add sections based on a user-selected value. The challenge I'm facing is to dynamically generate identical sections for each entry a user specifies in a previous field.
To illustrate with an example, let's say the form
is for entering passenger information for a flight. If a user indicates there are 3 passengers (using a numeric field), I need the form to automatically generate 3 identical sections, each dedicated to capturing the details for one passenger.
Could anyone guide me on how to achieve this in a Jira form? Are there any specific plugins, scripts, or built-in functionalities that I can leverage to create such dynamic forms?
Thank you in advance for your help!
Hi @Manuel Alvarez,
Welcome to Atlassian Community!
You cannot add new sections dynamically based on a number field the way you are describing. Those sections would have to already exist in the form for it to work. So lets say that you want to allow 1 - 10 passengers to be added, the you would have to have 10 sections defined in the form with identical fields.
Hi @Mikael Sandberg , thanks for the answer.
So the best solution would be having a final question after each section that triggers the unlocking of the following one.
Like:
Is there any passenger left?
Do you know how this would impact making API requests?
For example the response would have a JSON structure nested by the section name?
something like this? but in a proper JSON structure?
section1:
field1: value
field2: value
section2:
field1:value
field2:value
Thanks again!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You cannot use the API to create requests that has a form attached to it. Form does have an API, but it does not allow you to create a new form and add responses to it.
Regarding the structure of the form you could add the yes/no question to each section, or you could have a single drop-down for the user to select the number of passengers, and based on that you activate each section, something like this:
The first section would always be visible, and the following sections would conditionally visible based on the number of passengers selected above 1.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This was helpful for me, thank you :)
I added the sections as per your screen shots and in each section I put incremental tables which showed 1, 2, 3 etc rows depending on the number chosen in the conditional field.
A 3 rowed table shows because 3 was selected in the previous field.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.