My form page-type was derived from this tutorial. http://www.ssbits.com/creating-a-simple-contact-form/
In fact, the code was the same.
This is my form code.
class ContactPage_Controller extends Page_Controller
{
function ContactForm() {
// Create fields
$Params = Director::urlParams();
$fields = new FieldSet(
new TextField('Name', 'Name*'),
new EmailField('Email', 'Email*'),
new TextareaField('Comments','Comments*')
);
// Create action
$actions = new FieldSet(
new FormAction('SendContactForm', 'Send')
);
// Create action
$validator = new RequiredFields('Name', 'Email', 'Comments');
return new Form($this, 'ContactForm', $fields, $actions, $validator);
}
I tried changing
return new Form($this, 'ContactForm', $fields, $actions, $validator);
to
$form = new Form($this, 'ContactForm', $fields, $actions, $validator);
$protector = SpamProtecterManager::update_form($form, 'Captcha');
if($protector) $protector->setFieldMapping('Name', 'Email','Comments');
return $form;
And it ran fine, but I never see the captcha field.
How can I test out that it is working? I tried out some -spammy- comments such as free viagra and they went through... So Im kinda worried. Should there be something to check before it sends the email?
Or are those 3 lines it?
Thanks