getodk / web-forms

ODK Web Forms enables form filling and submission editing of ODK forms in a web browser. It's coming soon! ✨

Home Page:https://getodk.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Constant labels and translated labels don't work together

sadiqkhoja opened this issue · comments

I have two fields in the Form definition, one field has constant label and other one has the itext ref. When calling engine's initializeForm method, returned StringField.currentState.label is null.

Note: This works in Enketo and not in Collect.

image

Sample Form:

<?xml version="1.0"?>
<!-- This fixture is loosely derived from the Enketo test fixture itemset-relevant-2.xml -->
<h:html xmlns="http://www.w3.org/2002/xforms"
  xmlns:ev="http://www.w3.org/2001/xml-events"
  xmlns:h="http://www.w3.org/1999/xhtml"
  xmlns:jr="http://openrosa.org/javarosa"
  xmlns:odk="http://www.opendatakit.org/xforms"
  xmlns:orx="http://openrosa.org/xforms"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <h:head>
    <h:title>Static selects</h:title>
    <model odk:xforms-version="1.0.0">
      <itext>
        <translation lang="French">
          <text id="fruit:label">
            <value>1. Sélectionnez un fruit</value>
          </text>

        </translation>
        <translation lang="English" default="true()">
          <text id="fruit:label">
            <value>1. Select a fruit</value>
          </text>

        </translation>
      </itext>
      <instance>
        <data id="static-selects">
          <first-question />
          <fruit>cherry</fruit>
          <meta>
            <instanceID />
          </meta>
        </data>
      </instance>
      <bind nodeset="/data/first-question" type="string" />
      <bind nodeset="/data/fruit" type="string" />
    </model>
  </h:head>
  <h:body>
    <input ref="/root/first-question">
      <label>Filter Fruits</label>
    </input>
    <input ref="/data/fruit">
      <label ref="jr:itext('fruit:label')" />
    </input>

  </h:body>
</h:html>

Never-mind, form definition is wrong.