I have a Symfony 2.3.4 form type that works, and one of the HTML tags that the form has is a select:
->add('aIdWorkerStatus', 'entity', array('class' => 'OsdRetireBundle:WorkerStatus'
, 'property' => 'description'))
The Entity WorkerStatus, has a few values and IDs and it works perfectly like that. But I have been struggling to add an arbitrary value in the select that displays a 'All' option on the select drop down list. Can any one help me? Regards and thank you.
empty_value is what you are looking for :
->add('aIdWorkerStatus', 'entity', array('class' => 'OsdRetireBundle:WorkerStatus'
, 'property' => 'description', 'empty_value' => 'All'))
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.