Thanks Mr.Freeze! Yes, it works now!!

Regards,
Zhe

On May 7, 9:48 am, "mr.freeze" <[email protected]> wrote:
> I think you want your pattern to be:
> pattern = '%' + request.vars.keyword.lower() + '%'
>
> instead of :
> pattern = '+ request.vars.keyword.lower() + '
>
> On May 7, 2:23 am, Zhe Li <[email protected]> wrote:
>
>
>
> > Hi  Massimo,
>
> > the only message I got from firebug is:
>
> > The 'charCode' property of a keyup event should not be used. The value
> > is meaningless.
>
> > when typing in the field. Is there any other ways to debug it?
>
> > Cheers,
> > Zhe
>
> > On May 6, 5:18 pm, mdipierro <[email protected]> wrote:
>
> > > To help us debug this... can you try with firefox? can you also try
> > > with the firebug extension? I will log the ajax requests so you can
> > > see if there is an error?
>
> > > On May 6, 10:01 am, Zhe Li <[email protected]> wrote:
>
> > > > Hi,
>
> > > > I am new to web2py and it is a fantastic framework! The online book is
> > > > quite helpful until this week. I tried two AJAX examples but none of
> > > > them works and I don't have a clue what went wrong there.
>
> > > > First one is the wiki example:
> > > > ---------------------------------
> > > > 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() + '
> > > >      pages = 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 pages]
> > > >      return UL(*items).xml()
> > > > ------------------------------------
>
> > > > Nothing shows up when I type or submit my request.
>
> > > > Second one is the auto complete example:
> > > > ------------------------------------
> > > > def month_input():
> > > >     return dict()
>
> > > > def month_selector():
> > > >     if not request.vars.month:
> > > >         return "
> > > >     months = ['January', 'February', 'March', 'April', 'May',
> > > >             'June', 'July', 'August', 'September' ,'October',
> > > >             'November', 'December']
> > > >     selected = [m for m in months \
> > > >                 if m.startswith(request.vars.month.capitalize())]
> > > >     return ".join([DIV(k,
> > > >                   _onclick="jQuery('#month').val('k')",
> > > >                   _onmouseover="this.style.backgroundColor='yellow'",
> > > >                   _onmouseout="this.style.backgroundColor='white'"
> > > >                   ).xml() for k in selected])
> > > > ----------------------------------
>
> > > > Again, nothing shows up.... I was using Chrome on linux.... Could
> > > > anyone tell me how to get it work please? Many thanks!!!
>
> > > > Cheers,
> > > > Zhe

Reply via email to