Captcha check via ajax
Permalink
Hello,
I have an ajax form that validates form fields before running an action.
All fields are checked in an .js file to see if they exist. If they do not it alerts the user to input the data.
I have included the concrete captcha helper at the bottom, but am unsure how to check against the value the user has inserted because we are doing this via ajax.
If it was reloading the page again i would know how, but as its through ajax i have no idea how to do this.
Any guidance would be appreciated...
Where would i insert the code $captcha->check($field = 'ccmCaptchaCode') to check against the users input..?
Thanks
I have an ajax form that validates form fields before running an action.
All fields are checked in an .js file to see if they exist. If they do not it alerts the user to input the data.
I have included the concrete captcha helper at the bottom, but am unsure how to check against the value the user has inserted because we are doing this via ajax.
If it was reloading the page again i would know how, but as its through ajax i have no idea how to do this.
Any guidance would be appreciated...
---snippet from form (this is not the full form)----- <?php echo $form->text('email', $email, array('style' => 'width: 70%'))?> <?php echo $captcha->display(); ?> <?php echo $captcha->showInput(); ?> ------ Included in the page is my js-------------- $(function() { $('.error').hide(); $('input.text-input').css({backgroundColor:"#FFFFFF"}); $('input.text-input').focus(function(){ $(this).css({backgroundColor:"#ffffff"}); }); $('input.text-input').blur(function(){ $(this).css({backgroundColor:"#ffffff"}); });
Viewing 15 lines of 46 lines. View entire code block.
Where would i insert the code $captcha->check($field = 'ccmCaptchaCode') to check against the users input..?
Thanks