Empfehlungen: Erweiterte Suche

Form Helper kann Funktionen nicht ausführen

Unterstützung der Daten-Formatierung in den Views (DRY)

Form Helper kann Funktionen nicht ausführen

Beitragvon elrt » Di 5. Okt 2010, 21:52

Hey Leute,
ich habe mit meinem Formhelper ein Problem.

Ich versuche diesen Formhelper innerhalb eines selbsterstellten Helper zu laden.
Aber wenn ich $this->Form->create(...) ausführe (oder eine beliebig andere Funktion), dann kommt die
Fehlermeldung.

Notice (8): Undefined property: FormHelper::$Html [CORE\cake\libs\view\helpers\form.php, line 1220]
Code | Context


return sprintf(
$this->Html->tags['hidden'],

$fieldName = "_method"
$options = array(
"name" => "_method",
"value" => "POST"
)
$secure = true
$model = "Comment"

FormHelper::hidden() - CORE\cake\libs\view\helpers\form.php, line 1220
FormHelper::create() - CORE\cake\libs\view\helpers\form.php, line 283
CommentmakerHelper::testen() - APP\views\helpers\commentmaker.php, line 32
include - APP\views\comments\index.ctp, line 9
View::_render() - CORE\cake\libs\view\view.php, line 723
View::render() - CORE\cake\libs\view\view.php, line 419
Controller::render() - CORE\cake\libs\controller\controller.php, line 913
Dispatcher::_invoke() - CORE\cake\dispatcher.php, line 207
Dispatcher::dispatch() - CORE\cake\dispatcher.php, line 171
[main] - APP\webroot\index.php, line 83

Notice (8): Trying to get property of non-object [CORE\cake\libs\view\helpers\form.php, line 1220]
Code | Context


return sprintf(
$this->Html->tags['hidden'],

$fieldName = "_method"
$options = array(
"name" => "_method",
"value" => "POST"
)
$secure = true
$model = "Comment"

FormHelper::hidden() - CORE\cake\libs\view\helpers\form.php, line 1220
FormHelper::create() - CORE\cake\libs\view\helpers\form.php, line 283
CommentmakerHelper::testen() - APP\views\helpers\commentmaker.php, line 32
include - APP\views\comments\index.ctp, line 9
View::_render() - CORE\cake\libs\view\view.php, line 723
View::render() - CORE\cake\libs\view\view.php, line 419
Controller::render() - CORE\cake\libs\controller\controller.php, line 913
Dispatcher::_invoke() - CORE\cake\dispatcher.php, line 207
Dispatcher::dispatch() - CORE\cake\dispatcher.php, line 171
[main] - APP\webroot\index.php, line 83

Notice (8): Undefined property: FormHelper::$Html [CORE\cake\libs\view\helpers\form.php, line 322]
Code | Context

$this->setEntity($model . '.', true);
$attributes = $this->_parseAttributes($htmlAttributes, null, '');
return sprintf($this->Html->tags['form'], $attributes) . $append;

$model = "Comment"
$options = array(
"class" => "form",
"id" => "CommentAddForm"
)
$created = false
$id = false
$append = ""
$view = View
View::$base = "/cakephp"
View::$here = "/cakephp/comments"
View::$plugin = NULL
View::$name = "Comments"
View::$action = "index"
View::$params = array
View::$passedArgs = array
View::$data = NULL
View::$helpers = array
View::$viewPath = "comments"
View::$viewVars = array
View::$layout = "fakebook"
View::$layoutPath = NULL
View::$autoRender = true
View::$autoLayout = true
View::$ext = ".ctp"
View::$subDir = NULL
View::$theme = NULL
View::$cacheAction = false
View::$validationErrors = array
View::$hasRendered = false
View::$loaded = array
View::$modelScope = true
View::$model = "Comment"
View::$association = NULL
View::$field = NULL
View::$fieldSuffix = NULL
View::$modelId = NULL
View::$uuids = array
View::$output = false
View::$__passedVars = array
View::$__scripts = array
View::$__paths = array
View::$webroot = "/cakephp/"
View::$Form = FormHelper object
View::$Html = HtmlHelper object
View::$Session = SessionHelper object
View::$entityPath = "Comment."
$models = array(
"comment",
"user",
"subcomment",
"view"
)
$currentModel = "view"
$currentObject = View
View::$base = "/cakephp"
View::$here = "/cakephp/comments"
View::$plugin = NULL
View::$name = "Comments"
View::$action = "index"
View::$params = array
View::$passedArgs = array
View::$data = NULL
View::$helpers = array
View::$viewPath = "comments"
View::$viewVars = array
View::$layout = "fakebook"
View::$layoutPath = NULL
View::$autoRender = true
View::$autoLayout = true
View::$ext = ".ctp"
View::$subDir = NULL
View::$theme = NULL
View::$cacheAction = false
View::$validationErrors = array
View::$hasRendered = false
View::$loaded = array
View::$modelScope = true
View::$model = "Comment"
View::$association = NULL
View::$field = NULL
View::$fieldSuffix = NULL
View::$modelId = NULL
View::$uuids = array
View::$output = false
View::$__passedVars = array
View::$__scripts = array
View::$__paths = array
View::$webroot = "/cakephp/"
View::$Form = FormHelper object
View::$Html = HtmlHelper object
View::$Session = SessionHelper object
View::$entityPath = "Comment."
$object = Comment
Comment::$name = "Comment"
Comment::$belongsTo = array
Comment::$hasMany = array
Comment::$useDbConfig = "default"
Comment::$useTable = "comments"
Comment::$displayField = "id"
Comment::$id = false
Comment::$data = array
Comment::$table = "comments"
Comment::$primaryKey = "id"
Comment::$_schema = array
Comment::$validate = array
Comment::$validationErrors = array
Comment::$tablePrefix = ""
Comment::$alias = "Comment"
Comment::$tableToModel = array
Comment::$logTransactions = false
Comment::$cacheQueries = false
Comment::$hasOne = array
Comment::$hasAndBelongsToMany = array
Comment::$actsAs = NULL
Comment::$Behaviors = BehaviorCollection object
Comment::$whitelist = array
Comment::$cacheSources = true
Comment::$findQueryType = NULL
Comment::$recursive = 1
Comment::$order = NULL
Comment::$virtualFields = array
Comment::$__associationKeys = array
Comment::$__associations = array
Comment::$__backAssociation = array
Comment::$__insertID = NULL
Comment::$__numRows = NULL
Comment::$__affectedRows = NULL
Comment::$_findMethods = array
Comment::$User = User object
Comment::$Subcomment = Subcomment object
$modelEntity = "Comment"
$data = array(
"fields" => array(
"id" => array(),
"creator_id" => array(),
"receiver_id" => array(),
"content" => array(),
"kind" => array(),
"created" => array()
),
"key" => "id",
"validates" => array()
)
$recordExists = false
$actionDefaults = array(
"plugin" => null,
"controller" => "comments",
"action" => "add",
false
)
$htmlAttributes = array(
"class" => "form",
"id" => "CommentAddForm",
"method" => "post",
"action" => "/cakephp/comments/add",
"accept-charset" => "utf-8"
)
$attributes = "class="form" id="CommentAddForm" method="post" action="/cakephp/comments/add" accept-charset="utf-8""

FormHelper::create() - CORE\cake\libs\view\helpers\form.php, line 322
CommentmakerHelper::testen() - APP\views\helpers\commentmaker.php, line 32
include - APP\views\comments\index.ctp, line 9
View::_render() - CORE\cake\libs\view\view.php, line 723
View::render() - CORE\cake\libs\view\view.php, line 419
Controller::render() - CORE\cake\libs\controller\controller.php, line 913
Dispatcher::_invoke() - CORE\cake\dispatcher.php, line 207
Dispatcher::dispatch() - CORE\cake\dispatcher.php, line 171
[main] - APP\webroot\index.php, line 83

Notice (8): Trying to get property of non-object [CORE\cake\libs\view\helpers\form.php, line 322]
Code | Context

$this->setEntity($model . '.', true);
$attributes = $this->_parseAttributes($htmlAttributes, null, '');
return sprintf($this->Html->tags['form'], $attributes) . $append;

$model = "Comment"
$options = array(
"class" => "form",
"id" => "CommentAddForm"
)
$created = false
$id = false
$append = ""
$view = View
View::$base = "/cakephp"
View::$here = "/cakephp/comments"
View::$plugin = NULL
View::$name = "Comments"
View::$action = "index"
View::$params = array
View::$passedArgs = array
View::$data = NULL
View::$helpers = array
View::$viewPath = "comments"
View::$viewVars = array
View::$layout = "fakebook"
View::$layoutPath = NULL
View::$autoRender = true
View::$autoLayout = true
View::$ext = ".ctp"
View::$subDir = NULL
View::$theme = NULL
View::$cacheAction = false
View::$validationErrors = array
View::$hasRendered = false
View::$loaded = array
View::$modelScope = true
View::$model = "Comment"
View::$association = NULL
View::$field = NULL
View::$fieldSuffix = NULL
View::$modelId = NULL
View::$uuids = array
View::$output = false
View::$__passedVars = array
View::$__scripts = array
View::$__paths = array
View::$webroot = "/cakephp/"
View::$Form = FormHelper object
View::$Html = HtmlHelper object
View::$Session = SessionHelper object
View::$entityPath = "Comment."
$models = array(
"comment",
"user",
"subcomment",
"view"
)
$currentModel = "view"
$currentObject = View
View::$base = "/cakephp"
View::$here = "/cakephp/comments"
View::$plugin = NULL
View::$name = "Comments"
View::$action = "index"
View::$params = array
View::$passedArgs = array
View::$data = NULL
View::$helpers = array
View::$viewPath = "comments"
View::$viewVars = array
View::$layout = "fakebook"
View::$layoutPath = NULL
View::$autoRender = true
View::$autoLayout = true
View::$ext = ".ctp"
View::$subDir = NULL
View::$theme = NULL
View::$cacheAction = false
View::$validationErrors = array
View::$hasRendered = false
View::$loaded = array
View::$modelScope = true
View::$model = "Comment"
View::$association = NULL
View::$field = NULL
View::$fieldSuffix = NULL
View::$modelId = NULL
View::$uuids = array
View::$output = false
View::$__passedVars = array
View::$__scripts = array
View::$__paths = array
View::$webroot = "/cakephp/"
View::$Form = FormHelper object
View::$Html = HtmlHelper object
View::$Session = SessionHelper object
View::$entityPath = "Comment."
$object = Comment
Comment::$name = "Comment"
Comment::$belongsTo = array
Comment::$hasMany = array
Comment::$useDbConfig = "default"
Comment::$useTable = "comments"
Comment::$displayField = "id"
Comment::$id = false
Comment::$data = array
Comment::$table = "comments"
Comment::$primaryKey = "id"
Comment::$_schema = array
Comment::$validate = array
Comment::$validationErrors = array
Comment::$tablePrefix = ""
Comment::$alias = "Comment"
Comment::$tableToModel = array
Comment::$logTransactions = false
Comment::$cacheQueries = false
Comment::$hasOne = array
Comment::$hasAndBelongsToMany = array
Comment::$actsAs = NULL
Comment::$Behaviors = BehaviorCollection object
Comment::$whitelist = array
Comment::$cacheSources = true
Comment::$findQueryType = NULL
Comment::$recursive = 1
Comment::$order = NULL
Comment::$virtualFields = array
Comment::$__associationKeys = array
Comment::$__associations = array
Comment::$__backAssociation = array
Comment::$__insertID = NULL
Comment::$__numRows = NULL
Comment::$__affectedRows = NULL
Comment::$_findMethods = array
Comment::$User = User object
Comment::$Subcomment = Subcomment object
$modelEntity = "Comment"
$data = array(
"fields" => array(
"id" => array(),
"creator_id" => array(),
"receiver_id" => array(),
"content" => array(),
"kind" => array(),
"created" => array()
),
"key" => "id",
"validates" => array()
)
$recordExists = false
$actionDefaults = array(
"plugin" => null,
"controller" => "comments",
"action" => "add",
false
)
$htmlAttributes = array(
"class" => "form",
"id" => "CommentAddForm",
"method" => "post",
"action" => "/cakephp/comments/add",
"accept-charset" => "utf-8"
)
$attributes = "class="form" id="CommentAddForm" method="post" action="/cakephp/comments/add" accept-charset="utf-8""

FormHelper::create() - CORE\cake\libs\view\helpers\form.php, line 322
CommentmakerHelper::testen() - APP\views\helpers\commentmaker.php, line 32
include - APP\views\comments\index.ctp, line 9
View::_render() - CORE\cake\libs\view\view.php, line 723
View::render() - CORE\cake\libs\view\view.php, line 419
Controller::render() - CORE\cake\libs\controller\controller.php, line 913
Dispatcher::_invoke() - CORE\cake\dispatcher.php, line 207
Dispatcher::dispatch() - CORE\cake\dispatcher.php, line 171
[main] - APP\webroot\index.php, line 83

Notice (8): Undefined property: FormHelper::$Html [CORE\cake\libs\view\helpers\form.php, line 569]
Code | Context


return sprintf(
$this->Html->tags['label'],

$fieldName = "content"
$text = "Content"
$options = array()
$labelFor = "CommentContent"

FormHelper::label() - CORE\cake\libs\view\helpers\form.php, line 569
FormHelper::_inputLabel() - CORE\cake\libs\view\helpers\form.php, line 980
FormHelper::input() - CORE\cake\libs\view\helpers\form.php, line 827
CommentmakerHelper::testen() - APP\views\helpers\commentmaker.php, line 33
include - APP\views\comments\index.ctp, line 9
View::_render() - CORE\cake\libs\view\view.php, line 723
View::render() - CORE\cake\libs\view\view.php, line 419
Controller::render() - CORE\cake\libs\controller\controller.php, line 913
Dispatcher::_invoke() - CORE\cake\dispatcher.php, line 207
Dispatcher::dispatch() - CORE\cake\dispatcher.php, line 171
[main] - APP\webroot\index.php, line 83

Notice (8): Trying to get property of non-object [CORE\cake\libs\view\helpers\form.php, line 569]
Code | Context


return sprintf(
$this->Html->tags['label'],

$fieldName = "content"
$text = "Content"
$options = array()
$labelFor = "CommentContent"

FormHelper::label() - CORE\cake\libs\view\helpers\form.php, line 569
FormHelper::_inputLabel() - CORE\cake\libs\view\helpers\form.php, line 980
FormHelper::input() - CORE\cake\libs\view\helpers\form.php, line 827
CommentmakerHelper::testen() - APP\views\helpers\commentmaker.php, line 33
include - APP\views\comments\index.ctp, line 9
View::_render() - CORE\cake\libs\view\view.php, line 723
View::render() - CORE\cake\libs\view\view.php, line 419
Controller::render() - CORE\cake\libs\controller\controller.php, line 913
Dispatcher::_invoke() - CORE\cake\dispatcher.php, line 207
Dispatcher::dispatch() - CORE\cake\dispatcher.php, line 171
[main] - APP\webroot\index.php, line 83

Notice (8): Undefined property: FormHelper::$Html [CORE\cake\libs\view\helpers\form.php, line 1138]
Code | Context

));
return sprintf(
$this->Html->tags['input'],

$fieldName = "content"
$options = array(
"type" => "text",
"maxlength" => 255,
"name" => "data[Comment][content]",
"value" => null,
"id" => "CommentContent"
)

FormHelper::text() - CORE\cake\libs\view\helpers\form.php, line 1138
FormHelper::input() - CORE\cake\libs\view\helpers\form.php, line 876
CommentmakerHelper::testen() - APP\views\helpers\commentmaker.php, line 33
include - APP\views\comments\index.ctp, line 9
View::_render() - CORE\cake\libs\view\view.php, line 723
View::render() - CORE\cake\libs\view\view.php, line 419
Controller::render() - CORE\cake\libs\controller\controller.php, line 913
Dispatcher::_invoke() - CORE\cake\dispatcher.php, line 207
Dispatcher::dispatch() - CORE\cake\dispatcher.php, line 171
[main] - APP\webroot\index.php, line 83

Notice (8): Trying to get property of non-object [CORE\cake\libs\view\helpers\form.php, line 1138]
Code | Context

));
return sprintf(
$this->Html->tags['input'],

$fieldName = "content"
$options = array(
"type" => "text",
"maxlength" => 255,
"name" => "data[Comment][content]",
"value" => null,
"id" => "CommentContent"
)

FormHelper::text() - CORE\cake\libs\view\helpers\form.php, line 1138
FormHelper::input() - CORE\cake\libs\view\helpers\form.php, line 876
CommentmakerHelper::testen() - APP\views\helpers\commentmaker.php, line 33
include - APP\views\comments\index.ctp, line 9
View::_render() - CORE\cake\libs\view\view.php, line 723
View::render() - CORE\cake\libs\view\view.php, line 419
Controller::render() - CORE\cake\libs\controller\controller.php, line 913
Dispatcher::_invoke() - CORE\cake\dispatcher.php, line 207
Dispatcher::dispatch() - CORE\cake\dispatcher.php, line 171
[main] - APP\webroot\index.php, line 83

Notice (8): Undefined property: FormHelper::$Html [CORE\cake\libs\view\helpers\form.php, line 918]
Code | Context

$tag = $divOptions['tag'];
unset($divOptions['tag']);
$output = $this->Html->tag($tag, $output, $divOptions);

$fieldName = "content"
$options = array(
"maxlength" => 255
)
$modelKey = "Comment"
$fieldKey = "content"
$magicType = true
$fieldDef = array(
"type" => "string",
"null" => false,
"default" => null,
"length" => 255
)
$type = "text"
$primaryKey = "id"
$map = array(
"string" => "text",
"datetime" => "datetime",
"boolean" => "checkbox",
"timestamp" => "datetime",
"text" => "textarea",
"time" => "time",
"date" => "date",
"float" => "text"
)
$types = array(
"checkbox",
"radio",
"select"
)
$view = View
View::$base = "/cakephp"
View::$here = "/cakephp/comments"
View::$plugin = NULL
View::$name = "Comments"
View::$action = "index"
View::$params = array
View::$passedArgs = array
View::$data = NULL
View::$helpers = array
View::$viewPath = "comments"
View::$viewVars = array
View::$layout = "fakebook"
View::$layoutPath = NULL
View::$autoRender = true
View::$autoLayout = true
View::$ext = ".ctp"
View::$subDir = NULL
View::$theme = NULL
View::$cacheAction = false
View::$validationErrors = array
View::$hasRendered = false
View::$loaded = array
View::$modelScope = true
View::$model = "Comment"
View::$association = NULL
View::$field = "content"
View::$fieldSuffix = NULL
View::$modelId = NULL
View::$uuids = array
View::$output = false
View::$__passedVars = array
View::$__scripts = array
View::$__paths = array
View::$webroot = "/cakephp/"
View::$Form = FormHelper object
View::$Html = HtmlHelper object
View::$Session = SessionHelper object
View::$entityPath = "content"
$varName = "contents"
$varOptions = null
$autoLength = true
$divOptions = array(
"class" => "input text"
)
$div = true
$label = ""
$error = null
$selected = null
$out = array()
$format = array(
"before",
"label",
"between",
"input",
"after",
"error"
)
$input = ""
$errMsg = null
$output = ""
$element = "error"
$tag = "div"

FormHelper::input() - CORE\cake\libs\view\helpers\form.php, line 918
CommentmakerHelper::testen() - APP\views\helpers\commentmaker.php, line 33
include - APP\views\comments\index.ctp, line 9
View::_render() - CORE\cake\libs\view\view.php, line 723
View::render() - CORE\cake\libs\view\view.php, line 419
Controller::render() - CORE\cake\libs\controller\controller.php, line 913
Dispatcher::_invoke() - CORE\cake\dispatcher.php, line 207
Dispatcher::dispatch() - CORE\cake\dispatcher.php, line 171
[main] - APP\webroot\index.php, line 83


( ! ) Fatal error: Call to a member function tag() on a non-object in C:\xampp\htdocs\cakephp\cake\libs\view\helpers\form.php on line 918



In den Fehlerzeilen im Formhelper sind es immer die $this->Html -Funktionen, die innerhalb des
Formhelpers nicht ausgefühert werden können ...

Gruß Thomas
elrt
 
Beiträge: 3
Registriert: Di 5. Okt 2010, 21:46

Re: Form Helper kann Funktionen nicht ausführen

Beitragvon euromark » Di 5. Okt 2010, 22:49

wie bindest du denn den Form Helper ein?
zeig ma den code
euromark
 
Beiträge: 642
Registriert: Fr 27. Jun 2008, 22:17
Wohnort: München
CakePHP-Version: 2.x
OS: Windows

Re: Form Helper kann Funktionen nicht ausführen

Beitragvon elrt » Di 5. Okt 2010, 23:26

Hey,

hab mittlerweile fast alles ausprobiert. Eigentlich sollt es ja so laufen:

class CommentmakerHelper extends AppHelper{
var $helpers = array('Html','Form');
function displaySingleThread($id){ // Es wird die ID eines bestimmen HeadComments übergeben
App::import('Model', 'Comment');
... usw
echo $this->Form->create('Comment', array('class'=>'form','action' => 'add')); // hier ist der Formhelper
echo $this->input('content');
echo $this->Form->end('kommentieren');
}


}

hab es auch über App::Import versucht ...
also in meinen ctp-Templates funktioniert der Formhelper perfekt.

Gruß Thomas
elrt
 
Beiträge: 3
Registriert: Di 5. Okt 2010, 21:46

Re: Form Helper kann Funktionen nicht ausführen

Beitragvon elrt » Di 5. Okt 2010, 23:29

hab es auch so probiert:

App::import("Helper","Form");
$form = new FormHelper();
echo $form ->create(...)


aber auch so geht es nicht

Gruß Thomas
elrt
 
Beiträge: 3
Registriert: Di 5. Okt 2010, 21:46


Zurück zu Helper

Wer ist online?

Mitglieder in diesem Forum: 0 Mitglieder und 1 Gast

cron