[web2py] Re: Forms and their customisation

2010-11-29 Thread Emceha
Thanks :) both work great :) Marcin On Nov 29, 12:44 pm, "mr.freeze" wrote: > You can also use a widget: > > def textarea_widget(f,v): >     inp = SQLFORM.widgets.text.widget(f,v) >     inp['_cols'] = 50 >     inp['_rows'] = 50 >     return inp > > db.table.field.widget = textarea_widget > > On

Re: [web2py] Re: Forms and their customisation

2010-11-29 Thread Daniel Gonzalez
Hi, when i said: db.artykuly.textareafield.represent I want to say that "textareafield" was your field in the definition of your db. Like: db.define_table('artykuly', Field('yourtextareafield', 'text') I said that because i didn't know how your field is named :) Anyway, mr.freeze has sent

[web2py] Re: Forms and their customisation

2010-11-29 Thread Emceha
Thanks Daniel for hint. Unfortunately it looks like db object doesn't have textareafield attribute: google_appengine/web2py/gluon/sql.py", line 1703, in __getattr__ return dict.__getitem__(self,key) KeyError: 'textareafield' That's what I'm getting now :( On Nov 29, 11:43 am, Daniel Gonzale

[web2py] Re: Forms and their customisation

2010-11-29 Thread mr.freeze
You can also use a widget: def textarea_widget(f,v): inp = SQLFORM.widgets.text.widget(f,v) inp['_cols'] = 50 inp['_rows'] = 50 return inp db.table.field.widget = textarea_widget On Nov 29, 5:39 am, "mr.freeze" wrote: > You can do: > form = crud.create(db.table) > textarea = fo

[web2py] Re: Forms and their customisation

2010-11-29 Thread mr.freeze
You can do: form = crud.create(db.table) textarea = form.element('textarea') textarea['_rows'] = 50 textarea['_cols'] = 50 form.element will grab the first matching element. If you want to be more specific you can do: form.element('textarea',_id='table_field') On Nov 29, 4:11 am, Emceha wrote: >

Re: [web2py] Re: Forms and their customisation

2010-11-29 Thread Daniel Gonzalez
I dont know if this could work for you: def dodaj_artykul(): db.artykuly.textareafield.represent = lambda k: TEXTAREA(value=k, _cols=100, _rows=100) form=crud.create(db.artykuly,next='pokaz_artykul/[id]') return dict(form=form) I don't know how this could affect the functionlity of the

[web2py] Re: Forms and their customisation

2010-11-29 Thread Emceha
Thanks Daniel for prompt reply, I've read chapter 7 already, also did some google search - but I was wondering if there is easier way to do it - (with less code and maybe just passing some parameters on crud.create as it's not really customization I want to do - I would call it more like forms set