How to call a Form class in a controller?
Ex: Have the following contact form:
use Phalcon\Forms\Form,
Phalcon\Forms\Element\Text,
Phalcon\Forms\Element\Select;
class ContactForm extends Form
{
public function initialize()
{
$this->add(new Text("name"));
$this->add(new Text("telephone"));
$this->add(new Select("telephoneType", TelephoneTypes::find(), array(
'using' => array('id', 'name')
)));
}
}
And call it in controller like this:
class TestController extends \Phalcon\Mvc\Controller
{
public function indexAction()
{
$contact_form = new ContactForm();
//$this->view->disable();
}
}
But it get error: Fatal error: Class 'ContactForm' not found in C:\xampp\htdocs\vngarena-phalcon\app\controllers\TestController.php on line 13