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.

Data Model Questions /

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

Error when trying /dev/build with own Forms....

Go to End

3 Posts   1279 Views


Community Member, 8 Posts

8 September 2009 at 7:30pm

Hello! After going through the basic tutorials, i tried to build my own Forms. But ran into the following error:


The page is rendered.

The code for my form:

class Feedback extends Page {
	static $db = array();
	static $has_one = array(); 

class Feedback_Controller extends Page_Controller 
	function FeedbackForm() {
	//DropdownField Thema implementieren
	$source = array('Kritik' => 'Kritik', 'Anregungen' => 'Anregungen', 'Kommentare' => 'Kommentare');
	$ddfield = new DropdownField('Thema');
	$fields = new FieldSet(
			new TextField('Name'),
			new EmailField('EMAIL'), 
			new TextField('Berufsbezeichnung'), 
			new TextareaField($name="description", $title="Anregung", $rows=5, $cols=10, $value=""),
			new TextareaField($name="cusAdvantage", $title="Auf welche Weise wäre dieses Produktmerkmal für Sie vorteilhaft?", $rows=5, $cols=10, $value=""), 
			new TextareaField($name="featureAlreadyExists", $title="Haben sie dieses Merkmal schon bei einem anderen Produkt gesehen? Wenn ja , wo?", $rows=5, $cols=10, $value=""),
			new CheckboxField($name="answer", $title="Möchten Sie eine Antwort auf ihre Anregung erhalten?"),
			new CheckboxField($name="newsletter", $title="Möchten Sie sich für den kostenlosen Newsletter eintragen?")
		$actions = new FieldSet(new FormAction('doSubmitFeedback','Abschicken'));
		return new Form($this, 'CustomerFeedback', $fields, 	$actions);

	function doSubmitFeedback($data, $form) {
		$submitted = new FeedbackSubmission();


class FeedbackSubmission extends DataObject {
	static $db = array(
				'Name' => 'Text',
				'EMAIL' => 'Text',
				'Berufsbezeichnung' => 'Text',
				'Thema' => 'Text',
				'description' => 'Text',
				'cusAdvantage' => 'Text',
				'featureAlreadyExists' => 'Text',
				'answer' => 'Text',
				'newsletter' => 'Text'	
?> //located in /Templates/Layout and integrated in the from Tutorial 3

<div id="Content" class="typography">

Anything i did wrong?


Community Member, 8 Posts

8 September 2009 at 8:31pm

Ok, problem solved... but now i have the next one.

The Tables at the database are created, but the formdata is not written into them.

Same code as above...


Community Member, 8 Posts

9 September 2009 at 1:58am

Solved this one to...

the Form which i returned in "function FeedbackForm()" had a different name than the function itself and the template marker...