AJAX in combination with captcha

Permalink
Hello!

My problem seems to be simple:
I use a form (containing a captcha) which is submitted asynchronously using ajax.
An AJAX delivers the form's contents to a controller method.
Captcha validation does obviously not work now, just take a look at the code below:

View from where controller method is called. AJAX request works fine.
<form>
<?php
    $this->controller->captcha->display();
    $this->controller->captcha->showInput();
?>
</form>
<a id="buttonNewPost" href="<?=$saveNewPost?>">Send</a>


The relevant controller functions:
defined('C5_EXECUTE') or die(_("Access Denied."));
Loader::helper('validation/captcha');
class xyzController extends BlockController
{
public $captcha;
/**
* On Start
**/
public function on_start()
{
    $this->captcha = new ValidationCaptchaHelper();
}
/**
* Called from view.php  
**/

Obviously, there is no reference to the captcha-object anymore when receiving the ajax-request. But if I create a new one, the old captcha code is invalid.


Ideas, anybody?

Thanks in advance,

Julian

 
stewbiff replied on at Permalink Reply
Good idea I think I'll use it and try it outhttp://casinomeilleur.org