What is the correct way to incorporate recaptcha into a form_factory
form? I keep getting this in form.errors.
Storage: <Storage {'recaptcha': 'no data'}>. The captcha validates
fine as there is no 'recaptcha':'invalid!' pair in form.errors but
form.accepts fails. As always, thanks for any help.
def contact():
captcha = Recaptcha(request,"...","...")
from gluon.sqlhtml import form_factory
form = form_factory(SQLField
('auth_user',db.auth_user,default=auth.user.id,writable=False,readable=False),
SQLField
('subject','string',length=128,requires=IS_NOT_EMPTY()),
SQLField('message','text',requires=IS_NOT_EMPTY
()),
SQLField('recaptcha',widget=lambda self,value:
captcha)
)
if form.accepts(request.vars,session):
mail.send(to=['[email protected]'],subject='contact: ' +
request.vars.subject,message=request.vars.message)
session.flash = "Message sent"
redirect(URL(r=request,f='index'))
return dict(form=form)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py Web Framework" 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
-~----------~----~----~----~------~----~------~--~---