akvo / akvo-flow-mobile

Akvo Flow app
GNU General Public License v3.0
18 stars 16 forks source link

A user can send an empty string as an 'Other option' #1740

Closed iperdomo closed 2 years ago

iperdomo commented 3 years ago

A form definition with an option question can define that it "Allow other" values. A user answering that question can send an "empty" string as the other value.

Example of question definition.

    <question id="2790002" order="5" type="option" mandatory="true" localeNameFlag="false">
      <options allowOther="true" allowMultiple="true">
        <option value="Options Manual development">
          <text>Options Manual development</text>
        </option>
        <option value="Biodiversity monitoring tool development">
          <text>Biodiversity monitoring tool development</text>
        </option>
        <option value="Political and financial framework assessment">
          <text>Political and financial framework assessment</text>
        </option>
        <option value="Innovation platforms">
          <text>Innovation platforms</text>
        </option>
        <option value="Knowledge management and capacity strengthening">
          <text>Knowledge management and capacity strengthening</text>
        </option>
      </options>
      <dependency question="4800002" answer-value="Activity" />
      <text>Main subject</text>
    </question>

Example of generated response:

{
      "answerType": "OPTION",
      "iteration": 0,
      "questionId": "2790002",
      "value": "[{\"text\":\"Options Manual development\"},{\"text\":\"Biodiversity monitoring tool development\"},{\"isOther\":true}]"
}

You can see that the last object of the array has the property isOther but no text. The text property of each object in the array is mandatory. This suggests the user is allowed to not enter any text and add it as an extra option to the response.

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.