Massimo

Thanks for the fast answer. It worked as expected.

What shoud I do for the radio widget to display labels instead of the 
returned value. For instance, I would like the form display 'Material 
consumido' and, when submited, the post_vars return 'mpconsumida.csv'.

Obrigado
Ciro

P.S.: Is it possible for you to include PayPal as a payment method for your 
book in pdf?

-----Original Message----- 
From: Massimo Di Pierro
Sent: Wednesday, February 01, 2012 6:33 PM
To: web2py-users
Subject: [web2py] Re: TYPE Error with SQLFORM.factory

IS_IN_SET['mpconsumida':'mpconsumida.csv','produtovendido':'produtovendid
o.csv']

should be

IS_IN_SET({'mpconsumida':'mpconsumida.csv','produtovendido':'produtovendid
o.csv'})


On Feb 1, 1:21 pm, CalBR <calb...@gmail.com> wrote:
> I´m a newbie trying to learn how to use SQLFORM.factory. I´ve created
> the followiing controller:
>
> @auth.requires_login()
> def teste():
>     form =
> SQLFORM.factory(Field('arquivo',widget=SQLFORM.widgets.radio.widget,require 
> s=IS_IN_SET['mpconsumida':'mpconsumida.csv','produtovendido':'produtovendid 
> o.csv']))
>     return locals()
>
> The view, teste.html is:
>
> {{extend 'layout.html'}}
> <h1>Teste de seleção</h1>
> {{=response.toolbar()}}
> {{=BEAUTIFY(response._vars)}}
> {{=form}}
>
> But it is giving the the follwing error:
>
> <type 'exceptions.TypeError'> 'type' object is unsubscriptable
>
> Traceback (most recent call last):
>   File "gluon/restricted.py", line 204, in restricted
>   File "C:/Users/Ciro/Desktop/Web2py/applications/prods/controllers/
> default.py", line 63, in <module>
>   File "gluon/globals.py", line 172, in <lambda>
>   File "gluon/tools.py", line 2533, in f
>   File "C:/Users/Ciro/Desktop/Web2py/applications/prods/controllers/
> default.py", line 60, in teste
> TypeError: 'type' object is unsubscriptable
>
> Line 60 is the SQLFORM line.
>
> I see no error. Can anyone help me?
> Thanks
> Ciro 

Reply via email to