We are moving our forum in GitHub Discussions. For questions about Phalcon v3/v4 you can visit here and for Phalcon v5 here.

HTML5 like form input fields.

How can I produce HTML5 like form input fields using textField() helper? Now I get: <input type="text" size="30" name="price" id="price" value="" />

And I would like to get: <input type="text" size="30" name="price" id="price" value="">

Do I have to set something somewhere?

I know that tagHtml() can produce valid HTML5 like tag, by setting 3rd argument to false.


Use before Tag::textField() <?php \Phalcon\Tag::setDoctype(\Phalcon\Tag::HTML5); ?>


I see in other post that you use tag registerd in DI then you should use <?php $this->tag->setDoctype(\Phalcon\Tag::HTML5); ?>

edited Mar '14

Hmm... I am not. This was my first post, and the other one is about documentation bug, and that is it.

And what I did now is:


return new \Phalcon\Config(array(
    /** ... */
    'tag' => array(
        'doctype' => \Phalcon\Tag::HTML5

And in bootstrap file:

try {

     * Read the configuration
    $config = include __DIR__ . "/../app/config/config.php";

     * Setting doctype in tag

     /** ... */
} catch (\Exception $e) {
    echo $e->getMessage();

Better to use \Phalcon\Tag::setDoctype(\Phalcon\Tag::HTML5); in BaseController.php in initialize(), but if you want it in bootstrap ...


You are most probably right. This is my first day with Phalcon, and I am still getting to know it. Thanks!