dongshu7162 2012-07-19 21:51
浏览 31
已采纳

在Symfony2中使用选择字段类型时将选项标记为已选择

So, i'm building a small form with a choice. However, i want to pre-select some of those options, as if i was applying selected="selected". Could not find how in the docs. Help? :D

  • 写回答

2条回答 默认 最新

  • drq1257 2012-07-26 18:18
    关注

    Ended up being simpler than i thought:

    $form['form[selectionMenu]']->select(1);
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?