Closed jeverling closed 6 years ago
Hi @jeverling!
I totally agree, and Enketo actually has this feature (though only for online-only form views)! 👍🎉
It's just not exposed in the KoBoToolbox interface. You may want to request the feature or discuss a PR in one of the KoBo repos.
The feature is documented here: https://apidocs.enketo.org/v2#/post-survey (defaults
parameter).
For offline-capable views, I'd prefer to use a 3rd option: external data (XML or CSV) and then use a calculation to populate questions. Enketo has been designed to facilitate serving different external data documents to different users (most feasibly by using the existing authentication).
cc @jnm
Feel free to re-open if you want to discuss an addition to Enketo.
Hi @MartijnR, thanks for your fast reply! It's great to know that this functionality already exists. :)
@jeverling - have you found any issues/discussion about this in KoBo? I need this functionality, too.
Hello!
I am trying to use this pre-fill feature on my self hosted instance of kobotoolbox, but can't figure out why is not working. I am using this URL, to populate visita_SPV. for example
or
Can't get the correct sintaxis... what am I doing wrong?
thanks!!
what am I doing wrong?
You're not using the API to create the URL for you. Instead you're just guessing what you think the webform URL could perhaps be. Webform URL and passing data to the API have no syntax relation.
It would be a great feature if Enketo would allow forms to be dynamically pre-filled. With the
default
column in a XLSForm, you can pre-fill a form with static values. However, it seems for some use-cases dynamic pre-filling of values would be useful, for example sending out links to different groups that will pre-fill the same form with different values. It might also help with reproducing problems, where you can send a link to a form that doesn't work as expected with specific data to someone else.I think just url-encoding the answers to pre-fill could work well, e.g.
https://ee.kobotoolbox.org/x/#DpBV87r1?name=Jesaja+Everling&age=37
Another approach would be to "inject" XML into IndexedDB and to load it as a draft, but I think URLencoding should work good enough and is much simpler.
What do you think?