We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 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?

thanks

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...'