We are moving our forum in GitHub Discussions. For questions about Phalcon v3/v4 you can visit here and for Phalcon v5 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


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.


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