Oh, I figured out.
I should convert category.id to string :)
{{=" selected='selected'" if
str(category.id)==request.vars.category_name else ""}}>
On 9月19日, 午後4:52, Omi Chiba <[email protected]> wrote:
> Bruno,
>
> That was so quick !!
> I have one problem. category.id is int type but looks like
> request.vars.category_name is returned as string or something
>
> so this is not equal
> {{if category.id==request.vars.category_name:}}
>
> This works
> {{=" selected='selected'" if category.id==7 else ""}}>
>
> I want to convert request.vars.category_name to int when it exists (it
> doesn't exit when page is loaded first time but second, third...)
>
> On 9月19日, 午後4:13, Bruno Rocha <[email protected]> wrote:
>
>
>
>
>
>
>
> > FIX:
>
> > <option value="{{=category.id}}" {{=" selected='selected' " if
> > category.id==request.vars.category_name
> > else "" )}}
>
> > --
>
> > --
> > Bruno Rocha
> > [ About me:http://zerp.ly/rochacbruno]
> > [ Aprenda a programar:http://CursoDePython.com.br]
> > [ O seu aliado nos cuidados com os animais:http://AnimalSystem.com.br]
> > [ Consultoria em desenvolvimento web:http://www.blouweb.com]