We are creating survey links for our users with prefilled defaults from previous submissions.
We use Enketo for our surveys, and we use the ?d[<key_name>]=<value>
query parameters to prefill the survey. This has been working so far, but the issue comes in with the repeat block
sections. We are able to set the first item in a repeat block using the method mentioned above, but subsequent repeat items cannot be set using that syntax.
Example:
Snap shot of example submission
{
...
"username":"test_psa",
"generalgroup/ggcmain":"mowing pruning herbicide",
"generalgroup/herbicide":[
{
"generalgroup/herbicide/herbappmethod":"dry",
},
{
"generalgroup/herbicide/herbappmethod":"liquid",
}
],
...
}
Basic Enketo Defaults URL Format
`https://enketo.domain/survey/link?d[<key_name>]=
For this example we have tried the following formats:
One)
https://enketo.domain/survey/link
?d[username]=test_psa
&d[generalgroup/ggcmain]=mowing pruning herbicide
&d[generalgroup/herbicide/herbappmethod]=dry
&d[generalgroup/herbicide/herbappmethod]=liquid
This format will set the herbappmethod of the first repeat item, but will not create and set the second one. What acrtually happens is that the first repeat item gets populated with liquid
Two)
https://enketo.domain/survey/link
?d[username]=test_psa
&d[generalgroup/ggcmain]=mowing pruning herbicide
&d[generalgroup/herbicide[0]/herbappmethod]=dry
&d[generalgroup/herbicide[1]/herbappmethod]=liquid
This format will not set either fields.
Three)
https://enketo.domain/survey/link
?d[username]=test_psa
&d[generalgroup/ggcmain]=mowing pruning herbicide
&d[generalgroup/herbicide[0]/generalgroup/herbicide/herbappmethod]=dry
&d[generalgroup/herbicide[1]/generalgroup/herbicide/herbappmethod]=liquid
This format will not set either fields.