Hallo,
ich versuche auf CForm-Formularelemente zuzugreifen.
Dies wird mit Fatal error: Call to a member function error() on a non-object in
framework/web/form/CFormInputElement.php on line 232 quittiert.
Warum ist das so?
// Controller:
public function actionIndex()
{
$model = new tbl1;
$form = new CForm('application.views.site.registerForm',$model);
if($form->submitted('register') AND $form->validate())
{
// Fatal error: Call to a member function error() on a non-object in
//framework/web/form/CFormInputElement.php on line 232
echo $form->elements['username'];
}
}
<?php
// registerForm.php
return array(
'elements'=>array(
'username'=>array(
'type'=>'text',
),
'password'=>array(
'type'=>'password',
),
'<hr>',
'name'=>array(
'type'=>'text',
),
'vorname'=>array(
'type'=>'text',
)
),
'buttons'=>array(
'register'=>array(
'type'=>'submit',
'label'=>'Registrieren',
),
),
);