permettre la création de blocs par récurrence / allow recursive creation of group of fields
Description
Sometimes, a field could appears an variable number of times.
For example, a group of interview could contains several interviews without be able to define before filling the form if this will be 4 or 9 interviews.
Currently, one should create a group of fields containing an interview, represented through one field for each question. Then this group of field should be duplicated as much as necessary.
It also needs to define a max value of interviews.
It can also be wanted to hide any interview after the first one by default. Then, a boolean field can be added at the end of the group to check if another interview should be displayed.
At last, conditions should be associated to this group of field to automatically hide/display next interviews depending on the boolean value.
If displayed, this group should be allowed to be defined as required.
There should be a way to automatize the creation of group of fields.
What this feature would look/feel like
A naive implementation would be to design it as a tab GROUP_RECURSION where the first item (interview) would be accessed at GROUP_RECURSION[0] and the 1st field would be accessed at GROUP_RECURSION[0][0]. Last field of 1st GROUP_RECURSION[0] would be accessed in GROUP_RECURSION[0][N-1] so the number of fields in a group of fields must be defined with the GROUP_RECURSION tab.
The cell containing the boolean defining if next GROUP_RECURSION[] exists could be in GROUP_RECURSION[i][0] or in GROUP_RECURSION[i][N-1].
- If it is in GROUP_RECURSION[i][0], it is easier to determine how much groups have to be created.
- If it is in GROUP_RECURSION[i](N-1], fields will begin at counter 0.
I would prefer GROUP_RECURSION[i][0] which allow constant place for this boolean, whatever N.
Size of tab would be dynamically defined by user by defining the boolean filed (checkbox or whatever) like this:
- If GROUP_RECURSION[i][0]=1, then GROUP_RECURSION[1] will exist and GROUP_RECURSION.size>1
- If GROUP_RECURSION[i][1]=1, then GROUP_RECURSION[2] will exist and GROUP_RECURSION.size>2
- etc.
Recursively:
- If GROUP_RECURSION[i][j]=1, then GROUP_RECURSION[j+1] will exist and GROUP_RECURSION.size>j+1
Each row in this tab would represent a group of fields, and each column would represent the same type of field.
A cell would be the intersection of a row (group of fields) and a column (field). and represented as GROUP_RECURSION[i][j] where the group of fields is the (i+1)th and the field is the (j+1)th.
Example: in a serie of interview, a group of fields would represent the questions asked in an interview. In the end of the interview, one should decide if it another interview should occur (i.e. should we create another group of fields to enter the answers of the next interview). It could be a checkbox added as the last field of the interview group of fields. When this checkbox is checked, another group of fields is displayed after this one.
Technical consideration
At this time, this method would only allow 1 level of group of fields. It would not be possible to allow a group of fields A which would be recursive and inside each group A, a group B which would be recursive itself.
The default case for the checkbox at the end of group of field used to define if another create group of fields should be created should probably be set to "no creation" to avoid infinite loop.