I have a loop repeating n questions in random order for t times. The questions contain references to embedded fields. The embedded fields need to be changed in each iteration of the loop. The fields are not pre-populated.
I use javascript in addOnload() to change the embedded field data. What happens is that in the first iteration of the loop the embedded fields are not set. In the second iteration the fields are set.
It seems that addOnload() executes the setting of the embedded data only after the page loads (?).
Pseudocode to illustrate
For (t in times) {
set embedded data field of question n_i
display question n_i
set embedded data field of question n_i + 1
display question n_1 + 1
...
}
I cannot pre-populate the fields. I tried hiding the first loop iteration and using t+1 loop iterations, but this does not execude the code in iteratio no 1.
Any recommendations?
I am happy to use javascript directly without the embedded fields, i don't mind.
