-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Launch forms via odkcollect:// links, with entity preselection #2
base: master
Are you sure you want to change the base?
Conversation
…ollect://form/<form-id>", allowing an entity to be preselected with a query parameter.
31b4054
to
4af83e7
Compare
dd14201
to
f4afced
Compare
Selecting the feature via the intent works perfectly. I need to investigate further next week, but the form id in the intent URL seems to be causing an error on form submission hotosm/fmtm#1538 Perhaps the value of the form id is being injected somewhere it shouldn't be? When the form is submitted, the error is displayed: |
Thanks @amias-samir for the fix! The new build is available at: I cherry-picked this code on top of the 2024.1.3 release. |
I think something went wrong with the rebase: if it helps I can reset this to it's original state? Let me know! 😃 |
1a71f58
to
335fd6c
Compare
This proof of concept enables the use of a browsable link to launch the FormFillingActivity on a specific form. A query parameter in the link can also preselect an entity in the form.
The implementation consists of three parts:
Add an
<intent-filter>
to the manifest entry for FormFillingActivity, which catches URLs that begin withodkcollect://form/
Add a branch in the FormLoaderTask that handles an incoming intent with this kind of URL by looking up a specific form by its Form ID (e.g. "trees_follow_up") rather than its internal id (e.g. "forms/2").
Add a method
preselectEntity
that pre-answers a question in the form, according to a query parameter in the URL. The parameter name should match the name of the question, and the parameter value should be the UUID of the entity.With these changes, a webpage with a link such as the following will launch ODK Collect into the form filling flow, for a specific form, with an entity preselected:
For testing, the above HTML is available here so you can load it on a phone browser: https://zestyping.github.io/odkform