My mistake. Not
    form = SQLFORM(db.sugerencias)
    db.sugerencias.texto.widget=lambda
field,value:SQLFORM.widgets.TextWidget.widget(field,value,cols="35"
rows="8")

but

   db.sugerencias.texto.widget=lambda
field,value:SQLFORM.widgets.text.widget(field,value,cols="35"
rows="8")
    form = SQLFORM(db.sugerencias)


On Aug 6, 2:21 pm, Sebastian Bassi <sba...@gmail.com> wrote:
> On Fri, Aug 6, 2010 at 4:13 PM, mdipierro <mdipie...@cs.depaul.edu> wrote:
> > You can put it in the model is it should apply to all form for the
> > table or in the controller action that needs it.
>
> I put it in the controller and I get a syntax error:
>
> Traceback (most recent call last):
>   File "/home/sbassi/Downloads/web2py/gluon/restricted.py", line 176,
> in restricted
>     ccode = compile2(code,layer)
>   File "/home/sbassi/Downloads/web2py/gluon/restricted.py", line 163,
> in compile2
>     return compile(code.rstrip().replace('\r\n','\n')+'\n', layer, 'exec')
>   File 
> "/home/sbassi/Downloads/web2py/applications/sug3/controllers/default.py",
> line 13
>     db.sugerencias.texto.widget=lambda field,value:
> SQLFORM.widgets.TextWidget.widget(field,value,cols="35" rows="8")
>
>                                         ^
> SyntaxError: invalid syntax
>
> Here is the controller code:
>
> def index():
>     form = SQLFORM(db.sugerencias)
>     db.sugerencias.texto.widget=lambda field,value:
> SQLFORM.widgets.TextWidget.widget(field,value,cols="35" rows="8")
>     if form.accepts(request.vars, formname='indexform'):
>         response.flash = 'form accepted'
>     elif form.errors:
>         response.flash = 'form has errors'
>     else:
>         response.flash = 'please fill the form'
>     return dict(form=form)

Reply via email to