From 16475815a81ec42364c729b634188f2363ca13ee Mon Sep 17 00:00:00 2001 From: David Date: Mon, 6 Apr 2015 12:37:54 +0200 Subject: Fix TReCaptcha Validation It seems like captchaready is fired too soon, when recaptcha is not yet ready. Use jquery delegated events to work around this. --- framework/Web/UI/WebControls/TReCaptchaValidator.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'framework/Web') diff --git a/framework/Web/UI/WebControls/TReCaptchaValidator.php b/framework/Web/UI/WebControls/TReCaptchaValidator.php index e25d0f84..83bee07b 100644 --- a/framework/Web/UI/WebControls/TReCaptchaValidator.php +++ b/framework/Web/UI/WebControls/TReCaptchaValidator.php @@ -124,12 +124,9 @@ class TReCaptchaValidator extends TBaseValidator // (if we're in initial rendering or a postback then the result will be rendered directly to the page html anyway) $this->Page->IsCallback ? $fn.'('.$value.');' : '', '', - // wait for the captcha to be constructed - 'jQuery(document).on("captchaready:'.$control->getClientID().'",function() { ', - // install event handler that clears the validation error when user changes the captcha response field - 'jQuery('.TJavaScript::quoteString('#'.$control->getResponseFieldName()).').on("keyup",function() { ', - $fn.'("1");', - '});', + // install event handler that clears the validation error when user changes the captcha response field + 'jQuery("#'.$control->getClientID().'").on("keyup", '.TJavaScript::quoteString('#'.$control->getResponseFieldName()).', function() { ', + $fn.'("1");', '});', ))); } -- cgit v1.2.3