Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Form Questions /

Custom Form redirects to a blank site


3 Posts   2012 Views


Community Member, 12 Posts

6 April 2009 at 5:14pm

I created a form to update some data in a database. The first view of the site is fine but if I send the form via the automaticly generated button it will redirect me to a blank page. I looked into the source code of this blank page - it was empty, even no head tags or something like that- nothing.

Can anyone explain me this behavior?
I checked my sourcecode more than one time and didnt find a mistake but ... well maybe I´m overlooking something.

The whole thing is done by a subclass of Page and its Controller.
Here is a snippet of my Code, I also attached the whole file.

    * Das Formular für die Seite
    * Hier kann der Datensatz leicht manipuliert werden.
   function Form(){

      $auftrag = $this->getAuftrag();


         // Daten für die Dropdownliste Kunde holen
         $kunden = DataObject::get('Kunde');
         if ($kunden){
            $kundenSources = $kunden->toDropDownMap('ID', 'Name');   // Datenaufbereite

         $fields = new FieldSet(
            new TextField('Auftragsnummer', 'Auftragsnummer', $auftrag->Auftragsnummer),
            new TextField('Thema', 'Thema', $auftrag->Thema),
            new DateField('Startdatum', 'Startdatum', $this->DatumsWandler($auftrag->Startdatum)),
            new DateField('Enddatum', 'Enddatum', $this->DatumsWandler($auftrag->Enddatum)),
            new CheckboxField('Abgeschlossen', 'Abgeschlossen', $auftrag->Abgeschlossen),
            new DropdownField('KundeID', 'Kunde', $kundenSources, $value=$auftrag->KundeID)

         $actions = new FieldSet(
            new FormAction('doAuftragUpdate', 'Auftrag aktualisieren')
         $validator = new RequiredFields(

         $form = new Form(

         return $form;


    function doAuftragUpdate($data, $form){

       $auftrag = $this->getAuftrag();
          $form->sessionMessage('Der Auftrag wurde erfolgreich aktualisiert', 'good');



Community Member, 712 Posts

7 April 2009 at 9:25pm

Hey there,

That would indicate that Director::redirectBack() is not working. Are you sure it is getting that far? Have you turned on dev-mode? What if you try Director::redirect('some-random-url')?


Community Member, 12 Posts

9 April 2009 at 2:53am

Its working.

I just add a else-conidtion in the funtion form()
Where I return a blank form