requires IS_IN_DB multiple and zero

192 views
Skip to first unread message

Thomas Bellembois

unread,
Jan 30, 2013, 5:41:16 AM1/30/13
to web...@googlegroups.com
Hello web2py community,

I have a multiple select widget:

db.PRODUCT.class_of_compounds.requires=[IS_EMPTY_OR(IS_IN_DB(db,
db.CLASS_OF_COMPOUNDS.id, label=db.CLASS_OF_COMPOUNDS._format,
multiple=True, sort=db.CLASS_OF_COMPOUNDS.label, zero='choose'))]

The "zero" field does not appear. If I change multiple from True to
False it appears.
I have probably missed something in the documentation...

How can a user then unselect an item ?

Regards,

Thomas

Anthony

unread,
Jan 30, 2013, 8:15:48 AM1/30/13
to web...@googlegroups.com
The "zero" option is intended for single-selection drop-downs to allow the user to make no selection. This is not necessary for multiple-selection inputs because it is already possible to make no selection simply by not clicking/checking any of the options.

Anthony

Thomas Bellembois

unread,
Jan 30, 2013, 8:36:34 AM1/30/13
to web...@googlegroups.com
Ok, thanks for the answer. It is now clear.
--
 
---
You received this message because you are subscribed to the Google Groups "web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

jim kaubisch

unread,
May 24, 2019, 8:32:23 PM5/24/19
to web2py-users
old posting, but have a related question - 

In a form dropdown, certainly multiple but probably under some circumstances single, how do I un-select a previous choice without choosing an alternative? Simple example is - currently I have chosen 3 elements of the list, a, b, c and now want to unselect b without choosing an alternative. i.e. I want the resulting list to be a,c (or even empty if I unselect all three), but I see no way of doing that. The "single" case is I have made a choice, now want to undo that choice, i.e. end up with an empty list

Am I missing something obvious?

Thanks

villas

unread,
May 25, 2019, 3:25:18 PM5/25/19
to web2py-users
Multiple = False
IS_IN_SET(['a', 'b', 'c'], zero=T('choose one'))
To unselect, click 'choose one' instead of whatever was selected.

Multiple = True
Unselect/remove everything which was previously selected.

...then submit the form.

jim kaubisch

unread,
May 26, 2019, 12:49:28 AM5/26/19
to web2py-users
Hi and thanks for the suggestions - 

 You seem to be saying:
          single   - the user should click on "select one" to NOT select ANY - when it's normal semantics is to force the user to selects one?
         multiple -  if 10 things are selected and you want to unselect 1, you need to unselect all 10, remember 9 and and start over again?

Am I misinterpreting?

I was hoping for something simpler/cleaner like - clicking on an entry currently selected unselects it; clicking on it again, reselects it.

Dave S

unread,
May 26, 2019, 4:24:03 AM5/26/19
to web2py-users


On Saturday, May 25, 2019 at 9:49:28 PM UTC-7, jim kaubisch wrote:
Hi and thanks for the suggestions - 

 You seem to be saying:
          single   - the user should click on "select one" to NOT select ANY - when it's normal semantics is to force the user to selects one?
         multiple -  if 10 things are selected and you want to unselect 1, you need to unselect all 10, remember 9 and and start over again?


If your browser is running on windows or linux, try holding down the control key and clikcing on the unwanted selected item.  On a Mac, the command key might do the same.  On phones and tablets, I dunno.
I don't have an app with a MULTIPLE to try this on.  Also, some behaviors aren't uniform across browsers, much less libraries, so this may work for one user and not for another.
 
Am I misinterpreting?

I was hoping for something simpler/cleaner like - clicking on an entry currently selected unselects it; clicking on it again, reselects it.


The control key feature is basically toggling the selection, but it isolates the item being clicked.  Contrast that with SHIFT-click, which is used for ranges.

Good luck!

/dps

jim kaubisch

unread,
May 28, 2019, 12:49:18 AM5/28/19
to web2py-users

Thanks, Dave, that did the trick. 

From the little I've tried, "command" seems to work (with Safari) for both single and Multiple. Haven't tried other browsers or the other platforms yet
Reply all
Reply to author
Forward
0 new messages