Hi all,
My problem is in form customizing, here's what I'm trying to do:
code/MyPage.php
class MyPage extends Page {
...
}
class MyPage_Controller extends Page_Controller {
function init() {
parent::init();
Requirements::javascript("mysite/javascript/jquery-1.2.6.min.js");
Requirements::javascript("mysite/javascript/order.js");
}
function DoOrder() {
$fields = new FieldSet(
new TextField(
$name = "name",
$title = "title",
$value = "asd"
)
);
$actions = new FieldSet(new FormAction("send", "Send"));
$required = new RequiredFields("name");
$form = new Form($this, "DoOrder", $fields, $actions, $required);
//here I tried two ways to achieve the form being skinned, but all of them gave me same error (will be listed below)
//first way
// $form = $this->customise($form)->renderWith('MyTemplate');
// return $form;
//second way
// $form = $form->renderWith('MyTemplate');
// return $form;
//well, last way - no template at all and only in this case form and form submission is working
return $form;
}
function send($data, $form ) {
print_r($form);
}
}
templates/MyPage.ss
$Content
$DoOrder
templates/includes/MyTemplate.ss
// here is my template for form, meaningless to write it here
Well, it's look all good, and it's even work and actually apply a template to form in first two cases (commented in code) and then render it to browser, but upno form submission an error acquires:
Fatal error: Call to a member function loadDataFrom() on a non-object in C:\Server\httpd\web\sapphire\core\control\Controller.php on line 178
Is there any other ways to customize form without errors? Or maybe my way to do this is good but not complete?