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

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.

add class css in form.render()

I'm using Phalcon\Forms, in form.render html ('name'). I want to add a css class like this: form.render ('name', css class add here). in case I don't want to use $ this-> name-> setAttributes (array ());



Just pass an array of attributes as the second parameter of render:

form.render("name", ["class": "my-class"])


Thanks so much!