Skip to content

feat(#2080): add section for default parameters - #2081

Open
garethbowen wants to merge 6 commits into
getodk:masterfrom
garethbowen:document-prefill-params
Open

feat(#2080): add section for default parameters#2081
garethbowen wants to merge 6 commits into
getodk:masterfrom
garethbowen:document-prefill-params

Conversation

@garethbowen

Copy link
Copy Markdown
Contributor

closes: #2080

What is included in this PR?

A section about using default parameters with public link URLs. I'm not convinced this is exactly the right place for this to live but it is the best option I could find right now.

What new issues will need to be opened because of this PR?

None.

What is left to be done in the addressed issue?

Nothing - but the web-forms feature should be merged and released before the documentation is pushed.

What problems did you encounter?

None.

Comment thread docs/central-submissions.rst Outdated
Comment thread docs/central-submissions.rst Outdated
Default Parameters
^^^^^^^^^^^^^^^^^^

You can add parameters to the public link URL to set values when the form is opened. This can be useful to fill the form with data that's available on the page where the link is clicked. Parameters must be in the format :code:`d[{XPath}]={value}`, where XPath is the ref of the element you want to set, and value is the string value. For example, :code:`d[/root/name]=odk` will set the string "odk" into the name element. To reduce the length of the URL omit the primary instance name and leading slash, for example: :code:`d[name]=odk`. Set values on multiple elements by including more parameters separated by an ampersand, :code:`d[name]=odk&d[engine]=webforms`.

@lognaturel lognaturel Aug 13, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't typically use "XPath", "ref", "primary instance" in user-facing docs.

The default root node name out of XLSForm is data, not root. I don't think we need to document that the root node name can be included, it's too much to explain for most users.

Here's an alternative proposal:

Parameters use the format :code:`d[{field}]={value}`, where ``field`` identifies the form field you want to set and ``value`` is the text to put in it. For example, :code:`d[name]=odk` sets the ``name`` field to ``odk``. For a field inside groups or repeats, include the names of the groups or repeats in the field identifier, separated by slashes. For example: :code:`d[person/name]=Maria`.

To set multiple fields, separate parameters with an ampersand (``&``), for example: :code:`d[name]=odk&d[engine]=webforms`.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@lognaturel lognaturel left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion inline!

@garethbowen
garethbowen requested a review from lognaturel August 13, 2026 22:43

@lognaturel lognaturel left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! Can't wait to release this!

Comment thread docs/central-submissions.rst Outdated

.. _central-submissions-link-default-parameters:

Default Parameters

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think "URL defaults" is more human?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I struggled with the naming here - I wanted something that people would understand but would also be a searchable feature. I'm not a fan of "url defaults" because it's ambiguous (is the URL defaulting to something?), but also would be hard to google for. I don't really like Default Parameters either. We could go for something verbose like "setting default values via the URL"?

Suggestions welcome...

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ChatGPT likes "URL pre-fill"

@yanokwa yanokwa Aug 31, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also liking "Set field values in the URL"

Then the user-facing benefit becomes

Speed up data entry by including known field values in the form's URL. ODK will automatically fill the matching fields when the form opens, so users can focus on entering what鈥檚 new.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yanokwa I've updated the title and added an intro paragraph borrowing from your user-facing benefit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Document how to prefill forms fields using query parameters

3 participants