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

additional options for html select

hi, say i have a: {{ selectstatic('id',['A':'active','I':'Inactive']) }} to generate: <select name="status" id="status"> <option value="A">Active</option> <option value="I">Inactive</option> </select>

how do i add 'disabled' or 'selected' to one of the options?


Selected can be added via Phalcon\Tag::setDefault(). Please read https://docs.phalcon.io/en/latest/reference/tags.html#setting-helper-values. Disabled option ....., I'm also wondering how to set it? Anybody knows?

'useEmpty' => true, 'emptyText' => 'Please Select...'