Jump to:

10990 Posts in 2727 Topics by 1818 members

All other Modules

SilverStripe Forums » All other Modules » Captcha field results in white page

Discuss all other Modules here.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 1158 Views
  • Mediaversa
    Community Member
    5 Posts

    Captcha field results in white page Link to this post

    Hello everyone,

    I'm trying to add a ReCaptcha field to my contact page's field. However when a form is filled including the captcha, the page directs me to a blank page, and the form is not send. The code i've used for the form:


    class ContactPage extends Page
       static $db = array(
       'Mailto' => 'Varchar(100)',
       'SubmitText' => 'HTMLText'
       function getCMSFields() {
       $fields = parent::getCMSFields();
       $fields->addFieldToTab("Root.Content.OnSubmission", new TextField('Mailto', 'Email submissions to'));
       $fields->addFieldToTab("Root.Content.OnSubmission", new TextareaField('SubmitText', 'Text on Submission'));
       return $fields;

    class ContactPage_Controller extends Page_Controller
       function ContactForm()
          $Params = Director::urlParams();
          // Create fields
          $fields = new FieldSet(
          new TextField('Bezoekdatum', 'Bezoekdatum *'),
          new TextField('Naam', 'Naam *'),
          new TextField('Vereniging', 'Vereniging'),
          new TextField('Adres', 'Adres / Nr *'),
          new TextField('Postcode', 'Postcode / Plaats *'),
          new TextField('Telefoon', 'Telefoon / Mobiel *'),
          new EmailField('ContactEmail', 'Email *'),
          new TextField('Aantal', 'Aantal Personen: (volwassenen en kinderen onder de 12) *'),
          new TextField('Tijdstip', 'Tijdstip *'),
          new DropdownField('Rondleiding', 'Rondleiding door de molens *',array("Ja"=> "Ja" , "Nee" => "Nee", ),''),
          new DropdownField('Wandeling', 'Wandeling met natuurgids *',array("Ja"=> "Ja" , "Nee" => "Nee"),''),
          new TextField('Drinken', 'Koffie / Thee (aantal invullen) *'),
          new TextField('Koek', 'Molenkoek (aantal invullen) *'),
          new TextareaField('Wensen','Overige wensen/vragen',4,16)
          // Create action
          $actions = new FieldSet(
          new FormAction('SendContactForm', 'Verzenden')
          // Create Validators
          $validator = new RequiredFields('Naam', 'ContactEmail', 'Bezoekdatum', 'Adres', 'Postcode', 'Telefoon', 'Aantal', 'Tijdstip', 'Rondleiding', 'Wandeling', 'Drinken', 'Koek');
          //return new Form($this, 'ContactForm', $fields, $actions, $validator);
          $form = new Form($this, 'ContactForm', $fields, $actions, $validator);
          $protector = SpamProtectorManager::update_form($form, 'Comments'); // to make the recaptcha work with your form
          return $form;
       function SendContactForm($data)
          //Set data
          $From = $data['ContactEmail'];
          $To = $this->Mailto;
          $Subject = "Aanmelding voor rondleiding via de website";
          $email = new Email($From, $To, $Subject);
          //set template
          //populate template
          //send mail
          //return to submitted message
          Director::redirect(Director::baseURL(). $this->URLSegment . "/?success=1");
       public function Success()
          return isset($_REQUEST['success']) && $_REQUEST['success'] == "1";


    Hope somebody knows a solution for this,


  • Willr
    Forum Moderator
    5502 Posts

    Re: Captcha field results in white page Link to this post

    the page directs me to a blank page

    Have you got display_errors turned on in your php.ini file (or can you look at your PHP error log for any errors).

Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.