The bug isn't with LABEL, it's with SQLFORM.search_menu, which tries to 
translate field.label without first converting to a string in case the 
label is an HTML helper.

Should be an easy fix, but for now, you can do:

label=str(IMG(...))

or

label=IMG(...).xml()

either of which will convert the HTML helper to a string, so it won't cause 
an error with the translator.

Also, note that you shouldn't need the LABEL wrapper -- in SQLFORMs, the 
labels are automatically wrapped in a LABEL().

Anthony

On Saturday, December 17, 2011 10:32:36 AM UTC-5, brushek wrote:
>
> But...
>
> LABEL have some bug:
>
> http://code.google.com/p/web2py/issues/detail?id=566
>
> On 16 Gru, 23:32, Anthony <abas...@gmail.com> wrote:
> > In your table definition, you can specify a 'label' argument for each
> > field, and I think that can be whatever you want (e.g., an IMG tag, 
> etc.).
> >
> > db.define_table('mytable', Field('myfield',
> > label=IMG(_src=URL('static','img/myimage.png'))))
> >
> > Haven't tried it, but hopefully should work.
> >
> > Anthony
> >
> >
> >
> >
> >
> >
> >
> > On Friday, December 16, 2011 5:10:53 PM UTC-5, brushek wrote:
> >
> > > Hello,
> >
> > > I would like to have images instead of text (or text AND image) in
> > > each label for row, when I click edit in form generated by
> > > SQLFORM.grid. How to do this in easiest way ?
> >
> > > Regards
> > > brushek
>
>

Reply via email to