1. What is the problem? Be very detailed.
I want to display metadata (Username) to the enumerator to remind them to update to their own name.
One way of doing so would be to set the default value of a field (text, read-only) to a metadata value (here: Username) and prompt the user to go back and update said field.
I managed to do so by hand-editing the XML:
/* The original metadata field of kind "Username" tells JavaRosa to preload its "property" with param "username". */
<bind nodeset="/data/reporter" type="string" jr:preload="property" jr:preloadParams="username"/>
/* A read-only text field as built in ODK Build */
<bind nodeset="/data/site_visit/reporter_repeat" type="string" readonly="true()"/>
/* Adding the two jr: properties to the read-only text field results in the Username being pre-loaded in the value */
<bind nodeset="/data/site_visit/reporter_repeat" type="string" jr:preload="property" jr:preloadParams="username" readonly="true()"/>
So that works, but hand-editing XML is a source of error (requires additional form validation) and a manual step (my forms live in ODK Build).
4. What steps can we take to reduce the problem?
Exactly my question. Is there a better/safer/more reproducible way than to hand-edit XForm XML?
5. Anything else we should know or have? If you have a test form or screenshots or logs, attach below.
I've attached the form in question as ODK Build savefile, as (modified) XML, and as XLSForms.
SiteVisitStart.zip (6.2 KB)
Related idea to place metadata in ODK Collect main menu: ODK Collect widget/shortcut for setting metadata (e.g. username) - #13 by Florian_May