we are both missing the _ widgets are helpers.

db.sugerencias.texto.widget=lambda
field,value:SQLFORM.widgets.text.widget(field,value,_cols="35",_rows="8",_onKeyUp="counterUpdate('question_2434','countBody','250');")

This is documented in the book. Chapter 7

On Aug 9, 1:56 pm, Sebastian Bassi <sba...@gmail.com> wrote:
> On Fri, Aug 6, 2010 at 1:36 PM, mdipierro <mdipie...@cs.depaul.edu> wrote:
> > db.table.field.widget=lambda field,value:
> > SQLFORM.widgets.TextWidget.widget(field,value,cols="35" rows="8")
>
> > You can add any attribute you need
>
> Is this documented somewhere?
> I found something strange, with this:
>
> db.sugerencias.texto.widget=lambda
> field,value:SQLFORM.widgets.text.widget(field,value,cols="35",rows="8")
> form = SQLFORM(db.sugerencias)
>
> I get this:
>
> <textarea class="string" cols="40" id="sugerencias_texto" name="texto"
> rows="10"></textarea>
>
> But I was expecting this:
>
> <textarea class="string" cols="35" id="sugerencias_texto" name="texto"
> rows="8"></textarea>
>
> Then I tried to add something else and I couldn't. I need to have it like 
> this:
>
> <textarea class="string" cols="35" id="sugerencias_texto" name="texto"
> rows="8" onKeyUp="counterUpdate('question_2434',
> 'countBody','250');"></textarea>
>
> To do this I tried:
>
> db.sugerencias.texto.widget=lambda
> field,value:SQLFORM.widgets.text.widget(field,value,cols="35",rows="8",onKeyUp="counterUpdate('question_2434',
> 'countBody','250');")
> form = SQLFORM(db.sugerencias)
>
> But it is ignored and I get:
>
> <textarea class="string" cols="40" id="sugerencias_texto" name="texto"
> rows="10"></textarea>
>
> So there are 2 problems, first I get 40 and 10 when I put 35 and 8,
> and the 2nd error is that the onKeyUp is ignored :(

Reply via email to