Are you talking about the IS_IN_SET() validator? I need to see some code. 
There is nothing in DAL that cases this. It must be a validator. So it 
depends on what you are using.

On Wednesday, 2 May 2012 17:29:35 UTC-5, Richard wrote:
>
> Ok DAL do will return [1,2,3] in case of the user has select the first 3 
> element of the referenced table.
>
> What Choosen plugin return (and what I would to be stored in database 
> field) could be [1,3,2] or [3,1,2] or what ever other order in which the 
> user had pick those referenced elements. Choosen allow that when use 
> multiple option.
>
> So I would like that the DAL return at the database level the order in 
> which the element have been entered in the field in case of use of plugin 
> like choosen. Off course it is not applying if someone is not using a 
> plugin because you can't know in which order the element have been selected.
>
> Now, I think that what prevent the DAL to return a unordered list to the 
> database is the use of dict... 
>
> I think I found a work around... But I didn't have time to implement it... 
> It consist of creating an other field to store the content of the 
> form.vars.field (list:reference field). So having 2 fields instead of 1...
>
> Hope it more clear.
>
> Richard
>
> On Wed, May 2, 2012 at 4:52 PM, Massimo Di Pierro <
> [email protected]> wrote:
>
>> Richard, I am at a loss about this. the dal does not sort, nor does the 
>> validator. Can you show me and example to reproduce this sorting?
>>
>>
>> On Thursday, 19 April 2012 16:14:50 UTC-5, Richard wrote:
>>>
>>>   Issue 768 <http://code.google.com/p/web2py/issues/detail?id=768>: Allow 
>>> insert of unsorted or unordered list:reference type field values 
>>> On Thu, Apr 19, 2012 at 5:08 PM, Richard Vézina <
>>> [email protected]> wrote:
>>>
>>>> Found this http://stackoverflow.com/**questions/1867861/python-**
>>>> dictionary-keep-keys-values-**in-same-order-as-declared<http://stackoverflow.com/questions/1867861/python-dictionary-keep-keys-values-in-same-order-as-declared>
>>>>  on 
>>>> stackoverflow where the most rated post redirect here :
>>>> http://dev.pocoo.org/hg/**sandbox/raw-file/tip/odict.py<http://dev.pocoo.org/hg/sandbox/raw-file/tip/odict.py>
>>>>
>>>> Notice, it will download odict.py into your computer that contain a 
>>>> class supposing to allow preservation of initial order in a python dict...
>>>>
>>>> I think, it could be nice to have this class added to web2py in order 
>>>> to allow insert into database of unordered list:reference field input...
>>>>
>>>> Since this could be slow (not in case of few value I think), it could 
>>>> be a choice offer to the user like : list:reference sorted or 
>>>> list:reference unsorted...
>>>>
>>>> What do you think??
>>>>
>>>> Richard
>>>>
>>>>
>>>> On Thu, Apr 19, 2012 at 4:59 PM, Richard Vézina <
>>>> [email protected]> wrote:
>>>>
>>>>> Some progress...
>>>>>
>>>>> I just make a check and chosen plugin multiple select option return a 
>>>>> unordered list of the picked element by the user...
>>>>>
>>>>> So, now, I think that it could be nice if web2py allow some way to 
>>>>> determine in case of use of chosen kind of plugin to store a unordered 
>>>>> list 
>>>>> in list:reference field...
>>>>>
>>>>> I think that it is near line 207 (web2py 1.99.4) gluon/sqlhtml that we 
>>>>> have to make change :
>>>>>
>>>>> class OptionsWidget(FormWidget):
>>>>>
>>>>>     @staticmethod
>>>>>     def has_options(field):
>>>>>         """
>>>>>         checks if the field has selectable options
>>>>>
>>>>>         :param field: the field needing checking
>>>>>         :returns: True if the field has options
>>>>>         """
>>>>>
>>>>>         return hasattr(field.requires, 'options')
>>>>>
>>>>>     @classmethod
>>>>>     def widget(cls, field, value, **attributes):
>>>>>         """
>>>>>         generates a SELECT tag, including OPTIONs (only 1 option 
>>>>> allowed)
>>>>>
>>>>>         see also: :meth:`FormWidget.widget`
>>>>>         """
>>>>>         default = dict(value=value) # HERE!!!!!!!!
>>>>>
>>>>> I am not pretty sure actually... And I don't really know, what could 
>>>>> be done to keep submit multiple list order in case of plugin use...
>>>>>
>>>>> I try naively to replace 
>>>>>
>>>>> default = dict(value=value)
>>>>>
>>>>> By 
>>>>>
>>>>> defautl = value
>>>>>
>>>>> But it failed.
>>>>>
>>>>> Richard
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> On Thu, Apr 19, 2012 at 3:43 PM, Richard Vézina <
>>>>> [email protected]> wrote:
>>>>>
>>>>>> This is a part of the solution I think :
>>>>>>
>>>>>> http://www.ryancramer.com/**journal/entries/select_**multiple/<http://www.ryancramer.com/journal/entries/select_multiple/>
>>>>>>
>>>>>> Richard
>>>>>>
>>>>>>
>>>>>> On Thu, Apr 19, 2012 at 3:08 PM, Richard <[email protected]
>>>>>> > wrote:
>>>>>>
>>>>>>> Hello,
>>>>>>>
>>>>>>> I would know if there is a way to tell to list:reference to not 
>>>>>>> order the id of the reference table to keep the order in wich the user 
>>>>>>> has 
>>>>>>> pick those element... At the same time I just thought that this concept 
>>>>>>> is 
>>>>>>> useless except in case you use some javascript plugin like Chosen 
>>>>>>> Multiple 
>>>>>>> Select 
>>>>>>> (http://harvesthq.github.com/**chosen/<http://harvesthq.github.com/chosen/>)
>>>>>>>  
>>>>>>> because, you pick the element in a list and there is no way to know 
>>>>>>> which 
>>>>>>> element in the list the user has selected first.
>>>>>>>
>>>>>>> My need is to allow users to select element from an other table and 
>>>>>>> keep a more informative those selected thing. Like the ingredient on 
>>>>>>> the 
>>>>>>> back panel of food box, the first ingredient more abondant than the 
>>>>>>> second 
>>>>>>> an so on.
>>>>>>>
>>>>>>> So, for now I think I am stock with a text field. I would avoid a 
>>>>>>> free text field because I would prefer user to always use the same name 
>>>>>>> for 
>>>>>>> the same thing, but I can't do it with text type field. What I thought 
>>>>>>> is a 
>>>>>>> list:reference field and a button beside the field to allow allow user 
>>>>>>> to 
>>>>>>> add missing element name in the foreign table if need without leave the 
>>>>>>> original form. This can be done easily with the select or add web2py 
>>>>>>> slice 
>>>>>>> : http://www.web2pyslices.com/**slice/show/1446/widget-select-**
>>>>>>> or-add-option<http://www.web2pyslices.com/slice/show/1446/widget-select-or-add-option>.
>>>>>>>  
>>>>>>> Thanks to the author.
>>>>>>>
>>>>>>> But, I think that keeping the order of the selected element can't be 
>>>>>>> done??
>>>>>>>
>>>>>>> Thanks for help.
>>>>>>>
>>>>>>> Richard
>>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>

Reply via email to