reCAPTCHA custom form parameter names
captcha, forms, http, javascript, recaptcha
Solution
It should not be possible. Probable solution, AFAIU, is the addition of new DOM elements which copy the values of the original ones right before the form submission, for example:
<!-- the HTML part -->
<input type="hidden" id="captchaId">
<input type="hidden" id="captchaUserResponse">
// the JavaScript (jQuery) part
$('form').submit(function(){
$('input#captchaId').
val($('input#recaptcha_response_field').val());
$('input#captchaUserResponse').
val($('input#recaptcha_challenge_field').val());
return true;
})
Problem
Is possible to customize reCAPTCHA form parameters (recaptcha_challenge_field and recaptcha_response_field) so that they are called differently? Basically I want the form parameter recaptcha_challenge_field to be called captchaId, and recaptcha_response_field to be called captchaUserResponse. I want them renamed so I can abstract the captcha implementation... when a request arrives on POST /mysite/userSignup I don't want to bother with captcha implementation (reCaptcha, or something else in the future) - extracting the right parameters for the right captcha implementation, I want to unify those parameter names. Now my request looks like this: ``` POST /mysite/userSignup HTTP/1.1 Host: localhost:80 Connection: keep-alive Content-Length: 416 Cache-Control: max-age=0 Origin: http://localhost:80 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.46 Safari/536.5 Content-Type: application/x-www-form-urlencoded Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Referer: http://localhost:8080/mysite/signup/form.html Accept-Encoding: gzip,deflate,sdch Accept-Language: en-US,en;q=0.8,hr;q=0.6 Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3 email:testUser%40gmail.com username:testUser password:test password2:test forename:Test surname:User recaptcha_challenge_field:<google generated challange> recaptcha_response_field:<user typed captcha answer> submit:Submit ``` But I want it to look like this: ``` POST /mysite/userSignup HTTP/1.1 Host: localhost:80 Connection: keep-alive Content-Length: 416 Cache-Control: max-age=0 Origin: http://localhost:80 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.46 Safari/536.5 Content-Type: application/x-www-form-urlencoded Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Referer: http://localhost:8080/mysite/signup/form.html Accept-Encoding: gzip,deflate,sdch Accept-Language: en-US,en;q=0.8,hr;q=0.6 Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3 email:testUser%40gmail.com username:testUser password:test password2:test forename:Test surname:User captchaId:<google generated challange> captchaUserResponse:<user typed captcha answer> submit:Submit ``` An elegant way would be to specify those form parameter names like this: ``` <script> var RecaptchaOptions = { recaptcha_challenge_field_formparam_name : 'captchaId', recaptcha_response_field_formparam_name: 'captchaUserResponse' }; </script> ``` If this isn't possible, what workaround do you suggest?