1779 Posts in 582 Topics by 556 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 2130 Views |
-
$form is undefined - but why? ..by SalvaStripe

18 February 2009 at 12:01am Last edited: 18 February 2009 12:16am
hey guys,
i get this error:
Notice: Undefined variable: form in /srv/www/vhosts/domain.de/subdomains/sifa/httpdocs/mysite/code/MUPage.php on line 68 Fatal error: Call to a member function saveInto() on a non-object in /srv/www/vhosts/marketingundpartner.de/subdomains/sifa/httpdocs/mysite/code/MUPage.php on line 68
and this is the code of my form:
<?php
class MUPage extends Page {
static $db = array(
);
static $has_one = array(
);
static $defaults = array(
);
}class MUPage_Controller extends Page_Controller {
function init() {
parent::init();
// Requirements::themedCSS("memberupload");
}function AlbumCreateForm() {
$fieldset = new FieldSet(
new TextField(
$name = "Name",
$title = "Albumname",
$value = ""
),
new TextareaField(
$name = "Desc",
$title = "Beschreibung",
$rows = 8,
$cols = 3,
$value = ""
),
new HiddenField (
$name = "Status",
$title= "status",
$value = "0"
),
new HiddenField (
$name = "OwnerID",
$title= "test",
$value = Member::currentUserID()
),
new HiddenField (
$name = "Date",
$title= "Datum",
$value = time()
)
);$actions = new FieldSet(
new FormAction('AlbumCreate', 'Erstellen')
);
return new Form($this, 'AlbumSenden', $fieldset, $actions);
}
function AlbumSenden($data, $form) {
$submission = new MUAlbum();
$form->saveInto($submission);
$submission->write();
Director::redirectBack();
}
}?>
THE FORM IS SHOWN, I GET THE ERROR AFTER CLICKING THE SEND BUTTON..
hmm.. i already did many form like this.. i cant find the error. Why the error says: "Notice: Undefined variable: form... ..."
Why is FORM undefined? -
Re: $form is undefined - but why? ..by SalvaStripe

18 February 2009 at 12:38am Last edited: 3 March 2009 4:36am
okay now it works
$actions = new FieldSet(
new FormAction('**HERE MUST NAME OF THE FUNCTION TO WRITE**', 'Erstellen')
);return new Form($this, '**HERE MUST NAME OF THIS FUNCTION**', $fieldset, $actions);
}
| 2130 Views | ||
|
Page:
1
|
Go to Top |
