oh it can ?:) sounds good, but still it solves only part of my
problem, I also want to change what is shown to the user in option, I
better show you what I want to do

    def getfolders(root = 0, spaces = '-'):
        folders = []
        for f in db(db_webfolder.id>0)(db_webfolder.parent==root)
(db_webfolder.file==None).select():
            folders.append((f.id,spaces+f.name))
            folders += getfolders(f.id, '-'+spaces)
        return folders

    folders = [(0,'root')]+getfolders()
    form_folder = FORM(SELECT([OPTION(name,_value=id) for id,name in
folders],_name='parent'),INPUT(_name='name'),INPUT
(_type='submit',_value="create"))

it should return something like
<select name="parent">
<option value="0">root</option>
<option value="1">-test</option>
<option value="5">--subfolder of test</option>
<option value="6">--another sub of test</option>
<option value="7">--another one</option>
<option value="2">-another folder</option>
<option value="3">-yet another</option>
<option value="4">-okok</option>
<option value="8">--tesing still</option>
</select>

On Jan 26, 10:59 pm, Thadeus Burgess <thade...@thadeusb.com> wrote:
> IS_IN_DB can use a query can't it?
>
> -Thadeus
>
>
>
> On Tue, Jan 26, 2010 at 3:46 PM, selecta <gr...@delarue-berlin.de> wrote:
> > Is there a validator that creates a select with options from a list of
> > tuples
>
> > what I want do do is
> > Field("folder","integer",requires = IS_IN_TUPLELIST([('myfolder',12),
> > ('subfoler',23)]))
>
> > so that is creates
> > SELECT([OPTION(name,_value=id) for name,id in [('myfolder',12),
> > ('subfoler',23)] ],_name='parent'),INPUT(_name='name')
>
> > in this case I cannot use IS_IN_DB because i need to filter the
> > results from the table
>
> > --
> > You received this message because you are subscribed to the Google Groups 
> > "web2py-users" group.
> > To post to this group, send email to web...@googlegroups.com.
> > To unsubscribe from this group, send email to 
> > web2py+unsubscr...@googlegroups.com.
> > For more options, visit this group 
> > athttp://groups.google.com/group/web2py?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.

Reply via email to