Problems with list:reference and SQLFORM

46 views
Skip to first unread message

VP

unread,
Oct 7, 2012, 10:18:34 AM10/7/12
to web...@googlegroups.com
 SQLFORM represents a reference field as a multiply-selected drop-down list, this presents two problems:

(1). If the referenced table has 10,000 entries, then they will be shown.  It's inefficient.  But it's somewhat unavoidable, given what it is.

(2). The other problem is more serious.  A multiply-selected drop-down list is not really a list, but rather a set.  It seems there is no way specify the order of the list and select multiple items.

Ideally, the way SQLFORM represents list:reference should be the same as list:integer, with an added validation making sure that all items are in the database.

Does anyone know how to solve (2)?


Anthony

unread,
Oct 7, 2012, 10:29:21 AM10/7/12
to web...@googlegroups.com
(1). If the referenced table has 10,000 entries, then they will be shown.  It's inefficient.  But it's somewhat unavoidable, given what it is.
 
Yes, you're probably better off using an autocomplete widget in a case like that.

(2). The other problem is more serious.  A multiply-selected drop-down list is not really a list, but rather a set.  It seems there is no way specify the order of the list and select multiple items.

IS_IN_DB takes an orderby argument -- have you tried that?
 
Ideally, the way SQLFORM represents list:reference should be the same as list:integer, with an added validation making sure that all items are in the database.

If you put the IS_IN_DB validator inside a list, you won't get the default select widget, but you'll still get the validation.

Anthony
Reply all
Reply to author
Forward
0 new messages