10386 Posts in 2198 Topics by 1712 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1162 Views |
-
Getting Mollom to work on custom form class

11 March 2010 at 5:50am Last edited: 14 March 2010 7:40am
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,
SamPS: 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 __constructfunction forTemplate() {
return $this->renderWith(array(
$this->class,
'Form'
));
}
}
?> -
Re: Getting Mollom to work on custom form class

11 March 2010 at 10:05am
Hi!
Don’t forget that the captcha does not appear if you’re logged-in as admin.
Hope it helps,
Juan -
Re: Getting Mollom to work on custom form class

11 March 2010 at 11:12am Last edited: 14 March 2010 7:33am
Hi,
Thanks for your response. Yes, I had tested my form while being logged out of admin - still no captcha.Sam
-
Re: Getting Mollom to work on custom form class

14 March 2010 at 7:34am
Does any one have any other suggestions (e.g., code edits)
Thanks,
Sam
| 1162 Views | ||
|
Page:
1
|
Go to Top |

