Hi,
Right now, I am not getting any captcha on my custom form. I would greatly appreciate it if someone could check my SpamProtectorManager method in my ContactForm.php code below to see if it is correct. I've asked for help in the Forms forum with this but haven't gotten any responses as of yet.
Thanks for the help,
Sam
PS: The is an abridged edited version of my previous post "Testing Mollom".
<?php
class ContactForm extends Form {
function __construct($controller, $name) {
$Params = Director::urlParams();
$fields = new FieldSet(
new TextField('Name', 'Name*'),
new EmailField('Email', 'Email*'),
new TextareaField('Comments','Comments*'));
$actions = new FieldSet(
new FormAction("SendContactForm", "Submit"));
$requiredFields = new RequiredFields('Name', 'Email', 'Comments');
$form = new Form($this, '__construct', $fields, $actions,$requiredFields);
$protector = SpamProtectorManager::update_form($form, 'Captcha');
if($protector) $protector->setFieldMapping('Name', 'Email','Comments');
// protector method based on example at http://svn.silverstripe.com/open/modules/mollom/trunk/INSTALL
parent::__construct($controller, $name, $fields, $actions,$requiredFields);
} // END __construct
function forTemplate() {
return $this->renderWith(array(
$this->class,
'Form'
));
}
}
?>