Skip to content
This repository has been archived by the owner on Nov 2, 2023. It is now read-only.

Follow-up question to select one seems broken #166

Closed
florianm opened this issue Jun 23, 2017 · 11 comments
Closed

Follow-up question to select one seems broken #166

florianm opened this issue Jun 23, 2017 · 11 comments

Comments

@florianm
Copy link
Contributor

I'm having a few troubles with the current "select one":

  • Select one inside groups are showing up as "invalid" no matter what I do with the follow up question. I see the inline error message "Because this control is within a single-screen group (field list), any expressions that reference other fields in the same group will not work."
  • The "Ask if the response is" dropdown is inactive when "Follow up question" is checked - shouldn't it be the other way around? This means I can't choose which option to follow up on.

A MWE: choice_one shows up as invalid in ODK Build, choice_two works.
Uploaded to an ODK Aggregate server and filled in in ODK Collect, the behaviour is:

  • choice_one is followed up by text_following_choice_one, both live in a group.
  • I can only follow up choice_one's option one (as ODK-B dropdown for follow up is inactive and won't let me change option to follow up on).
  • When selecting choice_one's option one (with follow up) I won't see the follow up field until I swipe forward and back again.
  • choice_two works fine, except that I can't choose which option to follow up on.

It would be awesome if the follow-up could be ignored inside groups (maybe the "invalid" status is a false positive?), and if the follow-up dropdown could be active when follow up is selected (bug?).

<h:html xmlns="http://www.w3.org/2002/xforms" xmlns:h="http://www.w3.org/1999/xhtml" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:jr="http://openrosa.org/javarosa">
  <h:head>
    <h:title>follow up bugs 0.1</h:title>
    <model>
      <instance>
        <data id="build_follow-up-bugs-0-1_1498200302">
          <meta>
            <instanceID/>
          </meta>
          <a_group>
            <choice_one/>
            <text_following_choice_one/>
          </a_group>
          <choice_two/>
          <a_text_field/>
        </data>
      </instance>
      <itext>
        <translation lang="English">
          <text id="/data/a_group:label">
            <value>A group</value>
          </text>
          <text id="/data/a_group/choice_one:label">
            <value>Invalid choice field</value>
          </text>
          <text id="/data/a_group/choice_one:hint">
            <value>this shows up as invalid</value>
          </text>
          <text id="/data/a_group/choice_one:option0">
            <value>choice one</value>
          </text>
          <text id="/data/a_group/choice_one:option1">
            <value>choice two</value>
          </text>
          <text id="/data/a_group/text_following_choice_one:label">
            <value>Some text</value>
          </text>
          <text id="/data/choice_two:label">
            <value>Working choice field</value>
          </text>
          <text id="/data/choice_two:hint">
            <value>this one will work</value>
          </text>
          <text id="/data/choice_two:option0">
            <value>choice one</value>
          </text>
          <text id="/data/choice_two:option1">
            <value>choice two</value>
          </text>
          <text id="/data/a_text_field:label">
            <value>A text field</value>
          </text>
          <text id="/data/a_text_field:hint">
            <value>cannot select on which option to follow up on</value>
          </text>
        </translation>
      </itext>
      <bind nodeset="/data/meta/instanceID" type="string" readonly="true()" calculate="concat('uuid:', uuid())"/>
      <bind nodeset="/data/a_group/choice_one" type="select1"/>
      <bind nodeset="/data/a_group/text_following_choice_one" type="string" relevant="(selected(/data/a_group/choice_one, 'one'))"/>
      <bind nodeset="/data/choice_two" type="select1"/>
      <bind nodeset="/data/a_text_field" type="string" relevant="(selected(/data/choice_two, 'one'))"/>
    </model>
  </h:head>
  <h:body>
    <group appearance="field-list">
      <label ref="jr:itext('/data/a_group:label')"/>
      <select1 ref="/data/a_group/choice_one" appearance="horizontal">
        <label ref="jr:itext('/data/a_group/choice_one:label')"/>
        <hint ref="jr:itext('/data/a_group/choice_one:hint')"/>
        <item>
          <label ref="jr:itext('/data/a_group/choice_one:option0')"/>
          <value>one</value>
        </item>
        <item>
          <label ref="jr:itext('/data/a_group/choice_one:option1')"/>
          <value>two</value>
        </item>
      </select1>
      <input ref="/data/a_group/text_following_choice_one">
        <label ref="jr:itext('/data/a_group/text_following_choice_one:label')"/>
      </input>
    </group>
    <select1 ref="/data/choice_two" appearance="horizontal">
      <label ref="jr:itext('/data/choice_two:label')"/>
      <hint ref="jr:itext('/data/choice_two:hint')"/>
      <item>
        <label ref="jr:itext('/data/choice_two:option0')"/>
        <value>one</value>
      </item>
      <item>
        <label ref="jr:itext('/data/choice_two:option1')"/>
        <value>two</value>
      </item>
    </select1>
    <input ref="/data/a_text_field">
      <label ref="jr:itext('/data/a_text_field:label')"/>
      <hint ref="jr:itext('/data/a_text_field:hint')"/>
    </input>
  </h:body>
</h:html>
@issa-tseng
Copy link
Member

Hey Florian; always good to hear from you.

You're right, something is goofy about the enable/disable state of the select box. I'm working on it.

To resolve that warning, you'll have to disable "Display on one screen" on the enclosing group. It's a limitation of Collect; it can't (doesn't bother to) reprocess the relevance logic while the whole group is already displayed.

issa-tseng added a commit to issa-tseng/odkbuild that referenced this issue Jul 24, 2017
@colinmccann
Copy link

Can we re-open this? I believe the issue of 'select question shown as invalid in group' issue is still not addressed.

From OP: Select one inside groups are showing up as "invalid" no matter what I do with the follow up question. I see the inline error message "Because this control is within a single-screen group (field list), any expressions that reference other fields in the same group will not work."

(props on all of the new changes btw - lots of great features added recently!)

@issa-tseng
Copy link
Member

hey colin: that's unfortunate. does it happen with all your forms? and—obvious question, i'm sorry, but are you sure none of the parent groups are marked as "Display On One Screen"?

@colinmccann
Copy link

colinmccann commented Jan 9, 2019 via email

@issa-tseng
Copy link
Member

unfortunately, the restriction is due to how XForms/JavaRosa/ODK Collect work.

the follow-up question functionality shows an additional text question only when some particular select option is chosen.

but Collect only decides whether or not to display a field at the time the field is presented. when "display on one screen" is selected, all fields are presented at once, and then the display logic is never reconsidered unless the entire group is navigated away from and then back to.

this means the follow-up question won't display when you'd expect, which is why we prevent the combination.

if your intention is to always display a text field that has a label teaching the user when to/when not to fill it out, then i would suggest just adding a plain text question after the select question rather than using the follow-up question feature.

@colinmccann
Copy link

colinmccann commented Jan 9, 2019 via email

@issa-tseng
Copy link
Member

photo didn't work. :)

@colinmccann
Copy link

colinmccann commented Jan 9, 2019

Heh, dang - trying again on GH

screen shot 2019-01-09 at 8 50 28 am

@issa-tseng
Copy link
Member

ah, that's definitely a bit goofier.

@issa-tseng issa-tseng reopened this Feb 13, 2019
@issa-tseng
Copy link
Member

apparently long ago when i implemented validations i got partially done with implementing a warning-level severity but never fully surfaced it. the intention with this validation check was to surface a warning, not an error. so the issue is not that the error should not appear, but rather that it should not be so scary.

issa-tseng added a commit to issa-tseng/odkbuild that referenced this issue Feb 13, 2019
* apparently long ago when i implemented validations i got partially
  done with implementing a warning-level severity but never fully
  surfaced it.
* and in particular, the field list expression check was meant to be a
  warning, not an error. it's supposed to show, but it's not supposed to
  look so scary.
* so here i finish implementing that.
issa-tseng added a commit to issa-tseng/odkbuild that referenced this issue Feb 15, 2019
…d error.

* in the relevance case we don't know if the expression refers within
  the group.
* but in the followup question case we do and it will never work (at
  least in odk collect).
* i guess non-collect-users just need to ignore the error..?
yanokwa pushed a commit to yanokwa/odk-build that referenced this issue Feb 16, 2019
* apparently long ago when i implemented validations i got partially
  done with implementing a warning-level severity but never fully
  surfaced it.
* and in particular, the field list expression check was meant to be a
  warning, not an error. it's supposed to show, but it's not supposed to
  look so scary.
* so here i finish implementing that.
issa-tseng added a commit that referenced this issue Mar 5, 2019
* apparently long ago when i implemented validations i got partially
  done with implementing a warning-level severity but never fully
  surfaced it.
* and in particular, the field list expression check was meant to be a
  warning, not an error. it's supposed to show, but it's not supposed to
  look so scary.
* so here i finish implementing that.
issa-tseng added a commit that referenced this issue Mar 5, 2019
* in the relevance case we don't know if the expression refers within
  the group.
* but in the followup question case we do and it will never work (at
  least in odk collect).
* i guess non-collect-users just need to ignore the error..?
@issa-tseng
Copy link
Member

fixed in #217.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants