We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Putting a array into text_field value

How i can putting a array into a text_field value using volt

I tried this:

{{ text_field('keywords', 'value': {% for k in app.getAppKeyword() %}{{ k.getAppKeyword() }}{% endfor %}) }}

But not work, display a syntax error:

Syntax error, unexpected token {%

Blocks cannot be embedded, that's why you get the syntax error...

{{ text_field('keywords', 'value': app.getAppKeyword()|join(', ')) }}

Blocks cannot be embedded, that's why you get the syntax error...

{{ text_field('keywords', 'value': app.getAppKeyword()|join(', ')) }}

Warning: join(): Invalid arguments passed in

edited Aug '15

Since we don't know what your actual function does and returns, it's quite hard to advise.

join expects an array/Iterable, so call it accordingly.