Sunday, October 7, 2012

Reload captcha not working in Internet Explorer 9

Here is a strange problem that seems specific to IE9.  I have a captcha code that works OK if the user enters the correct code straight away.  When I click "reload captcha" in IE9 the captcha is indeed redrawn, but when the "new"  captcha code is entered it never seems to match.  This problem does not occur in Google Chrome.  It seems that in IE9 the redrawn captcha does not match the code of the session variable, as if the session variable is not refreshed.  Also in IE9 clicking "reload captcha" a second time does not cause the captcha image to be redrawn.  The "reload captcha" link on the page changes colour after it is first clicked, to indicate that the link has already been visited.  Again this problem does not occur in Google Chrome.
 
There is already a time parameter on the captcha image:
<?php echo $this->Html->image($this->Html->url(array('controller' => 'contacts', 'action' => 'captcha', time()), true), array('style' => '', 'vspace' => 2)); ?>
 
I have no ideas on how to solve this problem.  Any help would be appreciated.
 
Here is more code from the view:
  <div id="normaltxt">Please enter the code!  Can not read this code?
   <?php
    echo $this->Js->link('Click here to reload!', array('action' => 'reload_captcha'),
     array('update' => '#captchaid'));
    echo $this->Js->writeBuffer();
   ?>
  </div>
... here is the code from the controller:
 function captcha($dummy = null) {
  $code = $this->Utils->captchaCode();
  $this->Utils->renderCaptcha($code);
  $this->Session->write('contact_captcha_code', $this->hashCaptcha($code));
 }
 function reload_captcha() {
  $this->autoRender = false;
  $this->layout = 'ajax';
  $this->viewPath = 'Elements'.DS;
  $this->render('reload_contact_captcha');
 }
... and the code in the element file is the same as the first line that I described above.
 
Thanks.

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
 
 

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate