reCaptcha integration

16 views
Skip to first unread message

CodeSlave9000

unread,
Oct 20, 2009, 12:09:36 PM10/20/09
to Lift
Hi - I think I'm following the rules in integrating reCaptcha into a
page, but I'm not seeing anything in the hidden fields when the form
is submitted. Am I making some kind of assumption I shouldn't be? I'm
rather new to Lift (and web development), so something on the simple
example side would probably be best understood.

Here's some stuff I have:
(in html form)
<script type='text/javascript' src='https://api-secure.recaptcha.net/
challenge?k=<code here>'>
</script>

<noscript>
<iframe src="https://api-secure.recaptcha.net/noscript?k=<code
here>" height="300" width="500" frameborder="0"></iframe><br/>
<textarea name="recaptcha_challenge_field" rows="3" cols="40">
</textarea>
<u:captcha/>
<!-- <input type="hidden" name="recaptcha_response_field"
value="manual_challenge"/> -->
</noscript>

And in my snippet, the captcha is bound to:
"captcha" -> SHtml.text(model.captcha.value, model.captcha.value = _,
"type" -> "hidden", "name" -> "recaptcha_response_field"),

model.captcha.value is always empty after form submission. Nothing
fancy here - just a regular form.
Thanks,
Chris


CodeSlave9000

unread,
Oct 20, 2009, 12:49:57 PM10/20/09
to Lift
replying to myself a bit here - starting to figure some of this out:

Turns out it doesn't submit the values in the form, but rather as
parameters to the submission. I see I can get at those through
S.param("recaptcha_challenge_field"), etc. This returns a Box
(Full), which I now need to figure out... I suspect I need to do some
kind of matching on it...

Naftoli Gugenheim

unread,
Oct 20, 2009, 3:10:09 PM10/20/09
to lif...@googlegroups.com
S.param("recaptcha_challenge_field") match {
  case Full(value) => // work with the value of 'value'
  case _ => // deal with the fact that there's no result.

David Pollak

unread,
Oct 20, 2009, 3:34:27 PM10/20/09
to lif...@googlegroups.com
For a little more on Box (and Option), see http://blog.lostlake.org/index.php?/archives/50-The-Scala-Option-class-and-how-lift-uses-it.html
--
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
Surf the harmonics
Reply all
Reply to author
Forward
0 new messages