#6040: FormHelper select not honoring $showEmpty without a string --------------------------+------------------------------------------------- Reporter: cuppett | Type: Bug Status: new | Priority: Medium Milestone: 1.2.x.x | Component: Helpers Version: 1.2 Final | Severity: Normal Keywords: | Php_version: PHP 5 Cake_version: | --------------------------+------------------------------------------------- PHP 5.2.8, CakePHP 1.2.1
Gauging from this signature in FormHelper: function select($fieldName, $options = array(), $selected = null, $attributes = array(), $showEmpty = '') It appears $showEmpty will default to ON using a blank value (and has been my experience pre 1.2). I'm calling it the following way: echo $form->select("Execution.category_id", $categories, NULL, array("onchange" => $onChange)); And the drop down doesn't have an empty element: <select name="data[Execution][category_id]" onchange="someJavascript();" id="ExecutionCategoryId"> <option value="210"> Lev0 </option> <option value="1"> New Features </option> <option value="132"> Severity - High </option> <option value="134"> Severity - Low </option> <option value="133"> Severity - Medium </option> <option value="142"> Treatments </option> </select> If I add the 5th parameter explicitly set to "true", it's still not there. However, when I put a string in such as "None", then it begins to show up. The $emptyMulti check in FormHelper->select() seemed suspicious. However, note that it doesn't matter whether I pass an attribute of "multiple" => true, the empty element does not appear. For some reason, true & "" are not behaving as intended and giving an empty option in the dropdown select. -- Ticket URL: <https://trac.cakephp.org/ticket/6040> CakePHP : The Rapid Development Framework for PHP <https://trac.cakephp.org/> Cake is a rapid development framework for PHP which uses commonly known design patterns like ActiveRecord, Association Data Mapping, Front Controller and MVC. Our primary goal is to provide a structured framework that enables PHP users at all levels to rapidly develop robust web applications, without any loss to flexibility. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "tickets cakephp" group. To post to this group, send email to tickets-cakephp@googlegroups.com To unsubscribe from this group, send email to tickets-cakephp+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/tickets-cakephp?hl=en -~----------~----~----~----~------~----~------~--~---