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

[SOLVED] Add class to selectStatic

Hey community!

Is there a posiibility to add a class to the volt-syntax of a select-box? In the following example I want the class "form-control" to be added to the select tag.

{{ selectStatic("searchtype", ["title": "Titel", "actors": "Schauspieler"], ["class":"form-control"]) }}

greetings Eike



5.3k
Accepted
answer

I think the documentation Volt syntax for this is missing the open and close brackets. Try

{{ selectStatic(["searchtype", ["title": "Titel", "actors": "Schauspieler"], "class":"form-control"]) }}

It looks like Volt is using json syntax, so when you see an array() in the $this-tag implementation, you need to enclose the params in [ ] to make it a javascript array.



12.1k

Thanks! This works! Sometimes it is so easy :)