The strange thing is that the captcha validation actually succeeds (you can test by putting an incorrect value in the captcha form and see if fail properly). I'm not sure why form.accepts is putting no_data into form.errors. Perhaps a bug?
On Nov 21, 10:49 am, Thadeus Burgess <thade...@thadeusb.com> wrote: > Ideally I would be able to create a form using SQLFORM(db.table) and then > insert the recaptcha field after the fact. I need to be able to display the > field in form.custom. But I may just be dreaming here :) > > Using your example, it gives a no_data error > > -Thadeus > > On Sat, Nov 21, 2009 at 9:25 AM, mr.freeze <nat...@freezable.com> wrote: > > > Something like this?: > > > def index(): > > use_recaptcha = True > > recaptcha_public = "..." > > recaptcha_private = "..." > > captcha = lambda f,v: Recaptcha(request, > > recaptcha_public,recaptcha_private) if use_recaptcha else '' > > form = SQLFORM.factory(Field('test',requires=IS_NOT_EMPTY()), > > Field('test2',widget=captcha) > > ) > > if form.accepts(request.vars,session): > > response.flash = "Got it" > > return dict(form=form) > > > Or if you don't need it in form.custom you can just insert it into the > > form: > > > def index(): > > use_recaptcha = True > > recaptcha_public = "..." > > recaptcha_private = "..." > > captcha = Recaptcha(request, recaptcha_public,recaptcha_private) > > form = SQLFORM.factory(Field('test',requires=IS_NOT_EMPTY()),Field > > ('test2')) > > if use_recaptcha: > > form[0].insert(-1, TR('', captcha, '')) > > if form.accepts(request.vars,session): > > response.flash = "Got it" > > return dict(form=form) > > > On Nov 21, 8:12 am, Thadeus Burgess <thade...@thadeusb.com> wrote: > > > And access it through custom form with.. > > > > {{=form.custom.widget.recaptcha}} > > > > -Thadeus > > > > On Sat, Nov 21, 2009 at 8:11 AM, Thadeus Burgess <thade...@thadeusb.com > > >wrote: > > > > > Is it possible to append Recaptcha to a SQLFORM, or SQLFORM.factory. > > > > > This would be ideal. > > > > > form = SQLFORM(db.table) > > > > > if somesettings.recaptcha=True > > > > > form.append(Recaptcha(....)) > > > > > -Thadeus > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---