Problems with list:reference and SQLFORM

Showing 1-2 of 2 messages
Problems with list:reference and SQLFORM VP 10/7/12 7:18 AM
 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)?


Re: Problems with list:reference and SQLFORM Anthony 10/7/12 7:29 AM
(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