try define

class IS_LIST_OF_STRINGS:
    def __call__(self,value):
         return [str(x) for x in value.split(',')]
    def formatter(self,value):
         return ', '.join(value)

and use

    Field(...,'list:string',requires=IS_LIST_OF_STRINGS())

On Aug 26, 4:27 pm, yamandu <yamandu.co...@gmail.com> wrote:
> Yes, I wish I could let the user input strings that don´t belong to
> predetermined set.
> A type of list that can add new itens does not make much sense for me.
> This is just a multi select, not properly a list in its most
> meaningful sense.
>
> On Aug 26, 5:36 pm, mdipierro <mdipie...@cs.depaul.edu> wrote:
>
> > This is not wrong.
>
> > The problem is that your field has type='list:string' but you did not
> > set requires=IS_IN_SET(('aaa','bbb','ccc')) or requires=IS_IN_DB(...)
> > Without the validator web2py does not know which options are valid and
> > which ones are not and does not know how to make a dropbox.
>
> > You have a valid point though. There should be a default validator
> > that allows to write strings separated by a comma or something like
> > plugin tagging. Such validator has not yet been created.
>
> > On Aug 26, 3:27 pm, yamandu <yamandu.co...@gmail.com> wrote:> I possibly 
> > found a problem with list:string field.
> > > I´ve searched for a widget and I could found one for it.
> > > So I starte to make my own based on 
> > > thishttp://blog.crazybeavers.se/wp-content/demos/jquery.tag.editor/
> > > I could be like that tag editor in plugin_wiki too but I found it
> > > harder to base on it.
>
> > > The problem is when you update a field of type list:string using the
> > > item1|item2|... syntax it parses correctly and saves like array
> > > ['item1','item2']
> > > But if you update the record it shows like ['item1','item2'] and if
> > > you simply save it without editing it saves as ['['item1','item2']']
>
> > > I think the correct would it to reverse parse it to the | syntax, via
> > > widget maybe.
> > > If it was like this it would be simpler to adpat the above mentioned
> > > jQuery plugin.
> > > But the way it is it´s need to do two types of parses.
>
> > > Is this really wrong or not?

Reply via email to