1. Home
  2. Data Collection
  3. How to: Pre-fill form fields using Enketo Express

How to: Pre-fill form fields using Enketo Express

If there are multiple fields you would like to prefill, then you would have to separate each of the other query parameters with an ampersand like the following example:


The characters after <prefill-value> will change for each form and are dependent on the URL assigned to the Enketo webform. For example, for the form with a URL https://enketo.ona.io/x/#ABC2, you would append #ABC2 after <prefill-value> as shown in the example above.

To retrieve the XPath of the field, you would need the xml of the form. You can retrieve the links to the xml representation of the forms you have access to by visiting https://odk.ona.io/<your-username>/formListand copying the contents in between downloadUrl tags for the specific form i.e when you visit https://odk.ona.io/<your-username>/formList, you will get something similar to the following:

 <xforms xmlns="http://openrosa.org/xforms/xformsList">
         <name>Form A</name>
         <name>Form B</name>

From the above example, to get the xml representation of Form B, follow the steps below:

  • Copy text in between the tag downloadUrlin our case https://odk.ona.io/jane/forms/2345/form.xmland open in a new tab;
  • Once you get to the webpage, right-click and select View Page Source to open the xml page;
  • The section that has the XPath to the fields in that particular form has bind tags and the XPath value can be found on the nodeset attribute on the same tag.

See the example below:

<bind nodeset="/form_B/browser_name" type="select"/>
<bind nodeset="/form_B/age_limit" type="int"/>
<bind nodeset="/form_B/current_location" type="geopoint"/>

This means that if I wanted to prefill the field age_limit when the webform loads, my url would be as follows:


The xpath is inside square brackets and it’s preceeded with letter d.

The format for multiple choice questions would be the same, however, the value has to be one of the names you have set on the choices worksheet for that specific field. Additionally, if you have multiple select fields and you would like to prefill more than one option, you will have to separate your value with %20 which means space. See the example below:


The url above means that the field multiple_select_field, which is a multiple-select field, will have options with names value1 and value2 selected when the form loads.

If you have a geopoint field, the format would be:


This means you might have something like:


Related Articles

Need Support?
Can't find the answer you're looking for?
Contact Support