Working with sections: inputs and inline results
We're going to work with sections, which is a feature that allows users to add 'rows' of inputs/outputs dynamically to your form, we'll explain how to get the inputs from inside these sections so you can use it at your code section, and also how to show some inline results inside the section. You must change a little bit the way to handle the inputs at the code section and the way you specify outputs, because when using sections, you will have many results to return, one per line.
Let's say you have a default input with 2 fields(input1 and input2), and an inline field (myinlineresult). You have at the code section, for ex:
This will work on a default form. Now if you decide to include the 3 fields inside a section, you will have a list of inputs, so you should return a list of outputs. So the inputs will be
$input1 and $input2 //for the first line
$input1 and $input2 //for the second line
$input1[n] and $input2[n] //for the nth+1 line
at the code you need to specify the result will be a list (array):
and then fill the values of each line
Please note we have used the first input to find out how many sections are present at the input form, using the php function 'count' to return the number of elements at 'input1' list.
This will fill at your result list all values, and you should see it showing dynamically inside the section.Last modified on