Thursday, April 5, 2012

Form Helper usage question

Hi there,
I'm a new user of this Framework and I've been reading the Cookbook the last
few days. Today I started my first Cake app and I have a problem regarding
the Form Helper usage since it doesn't creates the form in the view.

*My model code is:*

<?
class Usuario extends AppModel
{
var $name = "usuario";

// Atributos del Usuario
var $id;
var $username;
var $email;
var $password;
var $created;
var $modified;

}
?>


*My Controller Code (A brief, just the declarations and the function of the
form which is not working) is:*

<?
class UsuariosController extends AppController {

var $name = 'Usuario';
var $helpers = array('Html', 'Form');

function Agregar()
{
if ($this->request->is('post'))
{

if ($this->Usuario->save($this->request->data))
{
$this->Session->setFlash('El usuario fue creado');
$this->redirect(array ('action'=>'>Listar'));
}
}
}


}
?>


*The view:*

<?
echo "
Agregar Usuario
";

$this->Form->create('Usuario', array('action'=>'add', 'type'=>'post'));
$this->Form->input('username', array ('type'=>'text',
'label'=>'Usuario'));
$this->Form->input('email', array ('type'=>'email', 'label'=>'Email'));
$this->Form->input('password', array ('type'=>'password',
'label'=>'Contraseña'));
$this->Form->end('Agregar');

?>

All I get is the "Agregar Usuario" title, no form tags. I've tried to
instanciate again the Form Helper ($form = new FormHelper($this) ) but it
doesn't either work.

It might be a simple thing, but it's something serious for me since i'm just
starting with the Framework.
Many thanks in advance.

Leandro

--
View this message in context: http://cakephp.1045679.n5.nabble.com/Form-Helper-usage-question-tp5621651p5621651.html
Sent from the CakePHP mailing list archive at Nabble.com.

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: