Sorry. Yes it works completely. My code was just incorrect. Here's my
fixed example.

def cap():
    from gluon.tools import Recaptcha
    form=FORM(
            Recaptcha(request,public_key,private_key),
            INPUT(_type='submit'))
    if form.accepts(request.vars, session):
        response.flash = "yay"
    elif form.errors:
        response.flash = "nay"
    else:
        response.flash = "hey"
    return dict(form=form)


On Oct 9, 10:38 pm, devnull <[email protected]> wrote:
> Hm. The page loads with the error response flash. Other than that it
> works.
>
> def cap():
>     from gluon.tools import Recaptcha
>     form=FORM(
>             Recaptcha(request,public_key,private_key),
>             INPUT(_type='submit'))
>     if form.accepts(request.vars,session):
>         response.flash='done!'
>     else:
>         response.flash='nope.'
>     return dict(form=form)
>
> On Oct 9, 6:16 pm, mdipierro <[email protected]> wrote:
>
>
>
> > oops. fixed thanks. Please let us know if this works for you.
>
> > On Oct 9, 4:57 pm, devnull <[email protected]> wrote:
>
> > > Awesome -- thanks! (By the way, the page says [captcha and recaptha]
> > > and should say [captcha and recaptcha])
>
> > > On Oct 9, 5:24 pm, mdipierro <[email protected]> wrote:
>
> > > > The example was incorrect because uses an old file with bugs. You
> > > > should use the Recaptcha helper built in web2py. I fixed the example
>
> > > >http://www.web2py.com/AlterEgo/default/show/99
>
> > > > On Oct 9, 2:26 pm, devnull <[email protected]> wrote:
>
> > > > > The controller below initially displays the flash 'some other error in
> > > > > your form' right when the page loads.
>
> > > > > If I leave the captcha field blank and hit submit, it flashes 'done!'
> > > > > The same thing happens if I type something incorrect in the captcha
> > > > > field and then hit submit.
>
> > > > > What should I do differently? The example 
> > > > > fromhttp://www.web2py.com/AlterEgo/default/show/99
> > > > > looks ok to me... (Thanks in advance)
>
> > > > > public_key='(a very long key from reCAPTCHA)'
> > > > > private_key='(a very long key from reCAPTCHA with a hyphen in it)'
>
> > > > > def cap():
> > > > >     form=FORM(RECAPTCHA(request,public_key,private_key),INPUT
> > > > > (_type='submit'))
> > > > >     if form.accepts(request.vars,session): response.flash='done!'
> > > > >     elif form.errors.has_key('captcha'): response.flash='invalid
> > > > > captcha'
> > > > >     else: response.flash='some other error in your form'
> > > > >     return dict(form=form)
--~--~---------~--~----~------------~-------~--~----~
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