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.

Phalcon\Tag::setDefault 无效

in volt file : .... <input type="text" id="iput2" name="iput2" class="span6" size="30" /> ....

in Controller/Action: Phalcon\Tag::setDefault("iput2","test");

但是页面显示时没有值。。。。



33.9k
Accepted
answer
edited Sep '14

You can use something like this:

In controller:

        $tag = new \Phalcon\Forms\Element\Text('iput2');
        $tag->setDefault('test');

        $this->view->iput2 = $tag;

In view (volt):

    {{ iput2.render() }}

Or with tags:

In controller:

    \Phalcon\Tag::setDefault("ipu2", "test");

In volt:

    {{ text_field("ipu2") }}