Cht-core: Countdown timer does not show if there is a relevant

Created on 8 Mar 2018  路  14Comments  路  Source: medic/cht-core

A countdown-timer will never display if it has a relevant statement, even relevant="true()".

Sample form:

<?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 4279 A: timer with relevant</h:title>
    <model>
      <instance>
        <issue_4279_a delimiter="#" id="issue_4279_a" prefix="J1!issue_4279_a!" version="2018-03-08 17-42">
          <group>
            <timer/>
          </group>
          <meta>
            <instanceID/>
          </meta>
        </issue_4279_a>
      </instance>
      <instance id="contact-summary"/>
      <bind nodeset="/issue_4279_a/group/timer" readonly="true()" relevant="true()" type="string"/>
      <bind calculate="concat('uuid:', uuid())" nodeset="/issue_4279_a/meta/instanceID" readonly="true()" type="string"/>
    </model>
  </h:head>
  <h:body class="pages">
    <group appearance="field-list" ref="/issue_4279_a/group">
      <label>Testing Timer</label>
      <input appearance="countdown-timer" ref="/issue_4279_a/group/timer">
        <label>Text for timer</label>
      </input>
    </group>
  </h:body>
</h:html>
2 - Medium Bug

Most helpful comment

I don't think it's worth holding this ticket up to fix that. Created #5484 as an attempt to add a feature to correct this and add a check on medic-conf maybe.

All 14 comments

This was initially reported by @oneil0 in a project form. Confirmed on 2.14.0-beta.16 and 2.13.1, so it is not a recent regression, if it is one at all.

Any clue how to test this @vimemo ?

@ngaruko, did you try the sample form above in https://github.com/medic/medic-webapp/issues/4279#issue-303660216? The timer should show appropriately based on the relevant condition.

Using the form listed above I'm not seeing the timer when <bind nodeset="/issue_4279_a/group/timer" readonly="true()" relevant="true()" type="string"/> has the relevant="true()" statement. Removing it to be <bind nodeset="/issue_4279_a/group/timer" readonly="true()" type="string"/> does work.

Ready for AT in branch 4279-countdown-timer-relevant-fix.

After it passes we'll need to merge and forward port to `master.

@abbyad is there a time where relevant="false()" would be valid?

Yes, several years ago... :smile:
We were using that to hide fields and stopped once non-relevant fields were no longer saved with the form. There may be relics out there, but in general relevant="false()" should not be used anymore.

Would it be ok then to cause the form to show Contact your administrator error?

Ya, that is fine. Is a more descriptive error shown in console? Ideally we would also catch in medic-conf, either in converting the form or in uploading it.

The error in console is not really descriptive.

inbox.js:3 Error loading form Error: ["TypeError: Cannot read property 'scrollIntoView' of undefined"]
    at inbox.js:3
    at inbox.js:3
    at inbox.js:3
    at c.$digest (inbox.js:3)
    at inbox.js:3
    at Object.completeTask (inbox.js:3)
    at inbox.js:3

Ya, that would be difficult to decipher.

I don't think it's worth holding this ticket up to fix that. Created #5484 as an attempt to add a feature to correct this and add a check on medic-conf maybe.

Merged to 3.4.x and PR created for merge to master.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

abbyad picture abbyad  路  3Comments

alxndrsn picture alxndrsn  路  4Comments

abbyad picture abbyad  路  4Comments

diannakane picture diannakane  路  6Comments

abbyad picture abbyad  路  5Comments