Sorry, forgot that the label will get escaped. Anyway, there is now a fix
in trunk.
On Saturday, December 17, 2011 4:58:49 PM UTC-5, brushek wrote:
>
> > 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()
>
> None of this soulutions works :(. I mean, the app doesn't crash, but I
> can see the text:
>
> <img alt="Woda" src="/sdadmin/static/img_towary/1.png" />
>
> in label of row, but no image, it isn't that what I want.
>
> I tried:
>
> Field('tw1','integer',label=str(IMG(_alt='Woda',_src=URL('static','img_towary/
> 1.png')))),
> and:
> Field('tw1','integer',label=IMG(_alt='Woda',_src=URL('static','img_towary/
> 1.png')).xml()),
>
>
> >
> > either of which will convert the HTML helper to a string, so it won't
> cause
> > an error with the translator.
> >
>
> Indeed, but as You can see above, the output isn't image.
>
> > Also, note that you shouldn't need the LABEL wrapper -- in SQLFORMs, the
> > labels are automatically wrapped in a LABEL().
> >
>
> I need LABEL to make label with text AND image, and it works in:
>
> /app/default/planetysurowce/edit/gk_planety/1
>
> but not in:
>
> /app/default/planetysurowce
>
> where grid is computed.
>
> Anyway, thanks Anthony, I think (as You said) it will be quick fix,
> and all the stuff will work :)
>
> regards
> brushek
>
>