On 22/04/10 10:50, Branko Vukelic wrote:
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?

Something like this. I want to use $input.name in the template without using an if construction if there are not defined in input.


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.







--
Ferran at fompi.net
another sexy techie

--
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.

Reply via email to