add support for open select one in prompts

Yaw Anokwa avatarYaw Anokwa created an issue

carl

It appears that javarosa will accept any answer to a select1 question, even those not in the specified list (imagine a non-standard select UI). The answer will be there when you navigate and will also be there in the instance when you save the form.

However, it also appears that javarosa silently discards any answer not in the list when loading the form (the answer could come from a specified default value or from a loaded instance).

This behavior seems a little inconsistent to me. That is, either saving values not in the list should be disallowed, or values not in the list should not be discarded (especially not silently) when loading a new form.

The reason this came up is we had a student here try to develop an autocomplete widget, and he had the idea to use the select1 labels as appropriate values to autocomplete. However, since it's a text box, people can theoretically type anything unless we constrain it appropriately. So those values not in the list would disappear when loading a saved instance.

Having thought about this a bit I think it makes a little more sense to allow any values, and not discard them at load. It would enable things like "Other__" fields or other random interfaces using the appearance attribute, and a user could still specify a constraint if they'd like to ensure a standard 'select1' behavior.

andrew

  1. A select1 constrained to contain a single item from its list of items.
  2. An unconstrained select1. I might not call this a select1 anymore, I might call it a string input with items list.

clayton

This is supported in the XForms specification for select1 controls through the use of the selection="open" attribute, which we currently don't support. We could definitely add that into the core, though.

Definitely agreed that the current system is inconsistent. I believe that in-spec the behavior is that unless selection="open" is true, the control should throw an exception when it is loaded with an inconsistent value. Is that the behavior we want to support?"

Comments (0)

  1. Log in to comment
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.