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 /

Form creating, submit action problem


Reply


566 Views

Avatar
snaip

Community Member, 180 Posts

19 July 2012 at 8:43pm

Hi

I have problem with form. Submit action doesn't work:

FormIndex.php

class FormIndex extends Form {

function __construct($controller, $name) {
$fields = new FieldSet(
new TextField('FirstName', 'First Name'),
new TextField('Tel', 'Tel'),
new EmailField('Email', 'Email'),
new TextareaField('Frage', 'Frage')
);

$actions = new FieldSet(
new FormAction('doForm', 'Submit')
);

parent::__construct($controller, $name, $fields, $actions);
}

function doForm($data, $form) {
print_r($data);
exit;
// do procedures after form is submitted here
}

}

Start.php

class Start_Controller extends StaticPage_Controller {

public static $allowed_actions = array(
'doForm'
);

public function formularz(){
$form = new FormIndex($this,'FormIndex');
$form->setFormAction($this->link('doForm'));
return $form;
}

}

nothing happens, after submit form site is redirecting to /home/doForm but this action doesn't work

function doForm($data, $form) {
print_r($data);
exit;
// do procedures after form is submitted here
}