In your template:
$if name:
blah
$if surname:
blah
In your app code
db.select('names', where='name = $name OR surname = $surname', vars =
{'name': i.name, 'surname': i.surname})
Is this what you wanted?
On Thu, Apr 22, 2010 at 10:36 AM, Ferran Fontcuberta <[email protected]> wrote:
> Hello all;
>
> I have a search form which uses certain values (name, surname) which are
> passed again to the template to show what the user have searched; by now i'm
> using something similar to:
>
> i = web.input(
> name = None,
> surname = None
> )
> [...]
> if i.name:
> where += ...
> (same with surname)
>
> because if i don't initialize all the vars i'm using in the template, and i
> use "if 'name' in i" i get an error when parsing the template.
>
> Is this the preferred method or is there (i assume yes) a better way to
> achieve this?
>
> Thank you :)
>
> --
> You received this message because you are subscribed to the Google Groups
> "web.py" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/webpy?hl=en.
>
>
--
Branko Vukelić
[email protected]
[email protected]
Check out my blog: http://www.brankovukelic.com/
Check out my portfolio: http://www.flickr.com/photos/foxbunny/
Registered Linux user #438078 (http://counter.li.org/)
I hang out on identi.ca: http://identi.ca/foxbunny
--
You received this message because you are subscribed to the Google Groups
"web.py" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/webpy?hl=en.