Restrictions on # of selections

Hi Alison, these are limitations of the xform language / ODK collect as
far as I know.... I am including the odk-community list here, which might
be able to answer your question better.

Hi!

I was wondering if there is a way to restrict the total number of values
one can select for the select_multiple command (i.e. From a list of 10,
choose up to 3).

Similarly, I would like to have an id field that has to have 3 digits,
such that an id would be entered as "001" rather than "1". Is there a way
to require the number of characters an integer or string must have?

Thanks!
Alison

--
Prabhas Pokharel
http://twitter.com/prabhasp
Nepal mobile: +977 98137 91044
US mobile: +1 347 948 7654
skype/facebook/whatever: prabhasp

ยทยทยท On Fri, Mar 30, 2012 at 12:53 AM, Prabhas Pokharel < prabhas.pokharel@gmail.com> wrote: > On Thu, Mar 29, 2012 at 3:18 PM, Alison Connor wrote: -- Prabhas Pokharel http://twitter.com/prabhasp Nepal mobile: +977 98137 91044 US mobile: +1 347 948 7654 skype/facebook/whatever: prabhasp

Using constraint="count-selected(.) < 4" will limit the number of
selected items to no more than 3. See
http://opendatakit.org/help/form-design/binding for all the supported
XPath operators.

Similarly, you can use regular expressions to constrain answers to n
characters. Normal regular expressions should work but there is a bug
(see http://code.google.com/p/opendatakit/issues/detail?id=546) we
just found that needs to be fixed. For now, something like
contraint="regex(.,'^[0-9]{1}[0-9]{2}$')" will limit you to 3 digits.

ยทยทยท On Sat, Mar 31, 2012 at 11:07, Prabhas Pokharel wrote: > > > On Fri, Mar 30, 2012 at 12:53 AM, Prabhas Pokharel wrote: >> >> Hi Alison, these are limitations of the xform language / ODK collect as >> far as I know.... I am including the odk-community list here, which might be >> able to answer your question better. >> >> >> On Thu, Mar 29, 2012 at 3:18 PM, Alison Connor wrote: >>> >>> Hi! >>> >>> I was wondering if there is a way to restrict the total number of values >>> one can select for the select_multiple command (i.e. From a list of 10, >>> choose up to 3). >>> >>> Similarly, I would like to have an id field that has to have 3 digits, >>> such that an id would be entered as "001" rather than "1". Is there a way to >>> require the number of characters an integer or string must have? >>> >>> Thanks! >>> Alison >> >> >> >> >> -- >> Prabhas Pokharel >> http://twitter.com/prabhasp >> Nepal mobile: +977 98137 91044 >> US mobile: +1 347 948 7654 >> skype/facebook/whatever: prabhasp >> > > > > -- > Prabhas Pokharel > http://twitter.com/prabhasp > Nepal mobile: +977 98137 91044 > US mobile: +1 347 948 7654 > skype/facebook/whatever: prabhasp > > -- > Post: opendatakit@googlegroups.com > Unsubscribe: opendatakit+unsubscribe@googlegroups.com > Options: http://groups.google.com/group/opendatakit?hl=en
1 Like