How to prevent re-selection of previously selected item?

If i have a multi-select widget inside a repeat loop, is there a way to
prevent a user from selecting an item that has been previously selected?
The use case scenario : a multi-select where a user may not select an item
more than once.

/r
Nik

I've been mucking with the pyxform source code and discovered something
interesting - this is already supported. There are caveats though: it
doesn't follow xlsform convention: (1) the "names" couldn't be integers and
(2) labels are handled differently - "%(label)s" versus the conventional
${variable} notation.

*survey*

type name label:English appearance hint
begin_group g_farm_item
table-list Drop “table-list”. Incompatible with begin_loop.
begin_loop farm_items

select_one yes_no usage Do you use %(label)s ?

select_one yes_no ownership Do you own %(label)s ?

end_loop

end_group

choices

list name name label:English

yes_no 1 Yes

yes_no 2 No

farm_items fi_1 Beast of burden
Normally, my names are integer values (1, 2, etc.) but ODK complains if I
do that, hence the “fi_” prefix.
farm_items fi_2 Plow

farm_items fi_3 Harrow

farm_items fi_4 Mower

farm_items fi_5 Thresher

farm_items fi_6 Insecticide

farm_items fi_7 Farm tractor

farm_items fi_8 Hand tractor

farm_items fi_9 Mechanical dryer

farm_items fi_10 Harvester

farm_items fi_11 Granary / Warehouse / Silo

farm_items fi_12 Farm shed

farm_items fi_13 Irrigation pump

Is it safe to deploy a form using this? (By the way, there's a copy here:
http://formhub.org/n1kn0k/forms/list_loop)

Best,

Nik

··· On Thursday, July 5, 2012, ゴー・ニコライ wrote:

If i have a multi-select widget inside a repeat loop, is there a way to
prevent a user from selecting an item that has been previously selected?
The use case scenario : a multi-select where a user may not select an item
more than once.

/r
Nik

The loop feature of pyxform has been voted for removal by the dev team, and
the code hasn't been maintained for a little while now. So I would use with
caution (and make sure that you can run a version of pyxform that does
loops locally... see https://github.com/modilabs/pyxform/tags for a list;
looks like the current version works, and before that, you'll have to do
trial and error. (PS. try the loop outside the group to see if table-list
remains supported).

I don't quite clearly see how it solves your original problem though...
isn't the main technique you have used just changing the multi-select to a
series of select ones so that you can go through them one by one?

cheers,
--p

··· On Saturday, July 7, 2012 1:01:53 PM UTC+5:45, ニコノコ wrote: > > I've been mucking with the pyxform source code and discovered something > interesting - *this is already supported*. There are caveats though: it > doesn't follow xlsform convention: (1) the "names" couldn't be integers and > (2) labels are handled differently - "%(label)s" versus the conventional > ${variable} notation. > > *survey* > > > > > > *type* *name* *label:English* *appearance* *hint* > begin_group g_farm_item > table-list Drop “table-list”. Incompatible with begin_loop. > begin_loop farm_items > > > > > select_one yes_no usage Do you use %(label)s ? > > > select_one yes_no ownership Do you own %(label)s ? > > > end_loop > > > > > end_group > > > > *choices* > > > > > > *list name* *name* *label:English* > > > yes_no 1 Yes > > > yes_no 2 No > > > > > > > > > farm_items fi_1 Beast of burden > Normally, my names are integer values (1, 2, etc.) but ODK complains if I > do that, hence the “fi_” prefix. > farm_items fi_2 Plow > > > farm_items fi_3 Harrow > > > farm_items fi_4 Mower > > > farm_items fi_5 Thresher > > > farm_items fi_6 Insecticide > > > farm_items fi_7 Farm tractor > > > farm_items fi_8 Hand tractor > > > farm_items fi_9 Mechanical dryer > > > farm_items fi_10 Harvester > > > farm_items fi_11 Granary / Warehouse / Silo > > > farm_items fi_12 Farm shed > > > farm_items fi_13 Irrigation pump > > > Is it safe to deploy a form using this? (By the way, there's a copy here: > http://formhub.org/n1kn0k/forms/list_loop) > > Best, > > Nik > > > > On Thursday, July 5, 2012, ゴー・ニコライ wrote: > >> >> If i have a multi-select widget inside a repeat loop, is there a way to >> prevent a user from selecting an item that has been previously selected? >> The use case scenario : a multi-select where a user may not select an item >> more than once. >> >> /r >> Nik >> >

Prabhas, I accidentally hit reply instead of creating a new thread. The
loop had nothing to do with the original post.

Anyway, are you referring to the formhub dev team or the pyxform dev team?
So far, I can see how useful this loop is.

··· On Sunday, July 8, 2012, Prabhas Pokharel wrote:

The loop feature of pyxform has been voted for removal by the dev team,
and the code hasn't been maintained for a little while now. So I would use
with caution (and make sure that you can run a version of pyxform that does
loops locally... see https://github.com/modilabs/pyxform/tags for a list;
looks like the current version works, and before that, you'll have to do
trial and error. (PS. try the loop outside the group to see if table-list
remains supported).

I don't quite clearly see how it solves your original problem though...
isn't the main technique you have used just changing the multi-select to a
series of select ones so that you can go through them one by one?

cheers,
--p

On Saturday, July 7, 2012 1:01:53 PM UTC+5:45, ニコノコ wrote:

I've been mucking with the pyxform source code and discovered something
interesting - this is already supported. There are caveats though: it
doesn't follow xlsform convention: (1) the "names" couldn't be integers and
(2) labels are handled differently - "%(label)s" versus the conventional
${variable} notation.

*survey*

type name label:English appearance hint
begin_group g_farm_item
table-list Drop “table-list”. Incompatible with begin_loop.
begin_loop farm_items

--
Post: opendatakit@googlegroups.com <javascript:_e({}, 'cvml',
'opendatakit@googlegroups.com');>
Unsubscribe: opendatakit+unsubscribe@googlegroups.com <javascript:_e({},
'cvml', 'opendatakit%2Bunsubscribe@googlegroups.com');>
Options: http://groups.google.com/group/opendatakit?hl=en