I'm working my way through the manual, and doing the wiki in chapter
3.  Everything has worked fine (no mean feat for tutorials!), except
for one thing: the search function.  The relevant lines in the
controller are:

def search():
    "an AJAX wiki search page"
    return dict(form=FORM(INPUT(_id='keyword',_onkeyup="ajax('bg_find',
['keyword'],'target');")),\
        target_div=DIV(_id='target'))

def bg_find():
    "an AJAX callback that returns a <ul> of links to wiki pages"
    pattern='%'+request.vars.keyword.lower()+'%'
    mypages=db(db.page.title.lower().like(pattern)).select
(orderby=db.page.title)
    items=[A(row.title,_href=URL(r=request,f=show,args=[row.id])) for
row in mypages]
    return UL(*items).xml()

and I think these are what the manual has on p68.  The view file has:

{{extend 'layout.html'}}
<h1>Search wiki pages</h1>
[ {{=A('listall',_href=URL(r=request,f='index'))}} ]<br/>
{{=form}}<br/>
{{=target.div}}

as on p72 of the manual.  But when I go to that page, I get a ticket
saying:

Traceback (most recent call last):
  File "/home/kevin/revdata/downloads/webdev/web2py/gluon/
restricted.py", line 176, in restricted
    exec ccode in environment
  File "/home/kevin/revdata/downloads/webdev/web2py/applications/
mywiki/views/default/search.html", line 58, in <module>
NameError: name 'target' is not defined

I've been looking at this for an hour or so, and can't find any typos
in what I've done, so I wondering is there a typo in the manual?

Any advice would be very welcome.  Thanks.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py-users" 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/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to