Hello,
I love the way silverstripe is building forms, it saves a lot of time. I'm building a CRM and all code is in one file called page.php. To gain some oversight i thought it would be a good idea to make a class where i can put, for example, all candidate forms. Below is my setup and i think i'm pretty close but its not working yet. If someone has some ideas on how i can make this setup work or how i can accomplish my goal in another way, it would be really nice.
--------------page.php----------------
private static $allowed_actions = array(
'LoadFormProjectkaart',
'ProjectkaartForm',
);
public function LoadFormProjectkaart(){
return $this->renderWith(array('ProjectkaartForm', 'Page'));
}
public function ProjectkaartForm(){
$test = new KandidaatForms();
$form = $test->ProjectkaartForm();
return $form;
}
--------------KandidaatForms.php-------------------
Class KandidaatForms{
public function ProjectkaartForm(){
$fields = new FieldList(
new TextField('Name'),
);
$validator = new RequiredFields();
$actions = new FieldList(
new FormAction('WriteProjectKaart', 'Aanmaken')
);
$form = new Form($this, 'ProjectkaartForm', $fields, $actions, $validator);
return $form;
}
}
-------------------ProjectKaartForm.ss-----------------
$ProjectkaartForm
With this code a receive the following error:
Call to undefined method KandidaatForms::hasMethod() in /Applications/XAMPP/xamppfiles/htdocs/recruitment/framework/forms/Form.php on line 908
Thanks in advance for any suggestions