Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

form render problem

I try to make a form

In the controller I write this :


use Phalcon\Mvc\Controller;

class CrudController extends Controller


public function indexAction(){

$this->view->form = new CrudForm;




In the model I just write :


use Phalcon\Mvc\Model;

class Crud extends Model { //public $id;

public $name;

public $email;

public $city;


In the \forms\Crudform.php I write :


use Phalcon\Forms\Form;

use Phalcon\Forms\Element\Text;

use Phalcon\Forms\Element\Hidden;

use Phalcon\Validation\Validator\PresenceOf;

use Phalcon\Validation\Validator\Email;

class CrudForm extends Form


public function initialize($entity = null, $options = array())


  if (!isset($options['edit'])) {

      $element = new Text("id");


  } else {

      $this->add(new Hidden("id"));


.......... }


In the \views\crud\index.php, I try to render the form with : $form->render("name")

But, no form displayed.

Do I miss something in my codes ?


Might be only a typo, but the extension of view files should be phtml instead of php


thank you Lajos Bencz