Skip to content
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

The value from jr:choice-name() can be stale #3281

Closed
abbyad opened this issue Mar 24, 2017 · 4 comments
Closed

The value from jr:choice-name() can be stale #3281

abbyad opened this issue Mar 24, 2017 · 4 comments
Labels
Enketo Affects Enketo forms Priority: 1 - High Blocks the next release. Type: Bug Fix something that isn't working as intended

Comments

@abbyad
Copy link
Contributor

abbyad commented Mar 24, 2017

The value from a jr:choice-name() calculation is stale if the choice label is changed but the choice value is not. The choice-name function should be rerun if either the choice value or label are changed.

Will post test form shortly.

@abbyad abbyad added Type: Bug Fix something that isn't working as intended Enketo Affects Enketo forms labels Mar 24, 2017
@abbyad
Copy link
Contributor Author

abbyad commented Mar 24, 2017

Test form, which is also temporarily accessible here:

<?xml version="1.0"?>
<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:orx="http://openrosa.org/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <h:head>
    <h:title>Test Issue 3281</h:title>
    <model>
      <instance>
        <issue-3281 delimiter="#" id="issue_3281" prefix="J1!issue_3281!" version="2017-03-24">
          <input>Default Value</input>
          <translator>clinic</translator><output/><debug/>
          <note/>
          <meta>
            <instanceID/>
          </meta>
        </issue-3281>
      </instance>
      <bind nodeset="/issue-3281/input" type="string"/>
      <bind nodeset="/issue-3281/translator" type="select1"/>
      <bind calculate="jr:choice-name( /issue-3281/translator ,' /issue-3281/translator ')" nodeset="/issue-3281/output" type="string"/>
      <bind nodeset="/issue-3281/debug" readonly="true()" type="string"/>
      <bind nodeset="/issue-3281/note" readonly="true()" type="string"/>
      <bind calculate="concat('uuid:', uuid())" nodeset="/issue-3281/meta/instanceID" readonly="true()" type="string"/>
    </model>
  </h:head>
  <h:body>
    <input ref="/issue-3281/input">
      <label>Input</label>
    </input>
    <select1 ref="/issue-3281/translator">
      <label>Translator</label>
      <item>
        <label>[<output value=" /issue-3281/input "/>] District</label>
        <value>district_hospital</value>
      </item>
      <item>
        <label>[<output value=" /issue-3281/input "/>] Health Center</label>
        <value>health_center</value>
      </item>
      <item>
        <label>[<output value=" /issue-3281/input "/>] Area</label>
        <value>clinic</value>
      </item>
    </select1>
    <input ref="/issue-3281/debug">
      <label>jr:choice-name($ {translator},'$ {translator}') = **<output value=" /issue-3281/output "/>**</label>
    </input>
    <input ref="/issue-3281/note">
      <label>The value above is stale if _Input_ is changed and you leave the textbox since it modifies the choice label for _Translator_ but not the value. The choice-name function gets updated if the choice value is modified, but should also update if the choice label changes.</label>
    </input>
  </h:body>
</h:html>

Tested on 2.10.1

@alxndrsn
Copy link
Contributor

Required by 2017-03-30.

@alxndrsn
Copy link
Contributor

medic-enketo-0.9.2 released to fix this; upstream PR at enketo/enketo-core#414

@abbyad
Copy link
Contributor Author

abbyad commented Mar 30, 2017

Seems to be working well in 2.10.3-beta. Moving to Ready.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enketo Affects Enketo forms Priority: 1 - High Blocks the next release. Type: Bug Fix something that isn't working as intended
Projects
None yet
Development

No branches or pull requests

3 participants