Hi Daniel,
For more information about the HTML helper and its functions refer to
the API or have a look at the inline documentation of the file html.php
(located in cake/libs/view/helpers).
Searching for the function selectTag supplies you with the following
comment:
/**
* Returns a formatted SELECT element.
*
* @param string $fieldName Name attribute of the SELECT
* @param array $optionElements Array of the OPTION elements (as
'value'=>'Text' pairs) to be used in the SELECT element
* @param mixed $selected Selected option
* @param array $selectAttr Array of HTML options for the opening
SELECT element
* @param array $optionAttr Array of HTML options for the enclosed
OPTION elements
* @param boolean $show_empty If true, the empty select option is shown
* @param boolean $return Whether this method should return a
value
* @return string Formatted SELECT element
*/
function selectTag($fieldName, $optionElements, $selected = null,
$selectAttr = null, $optionAttr = null, $showEmpty = true, $return =
false) {
The 6th parameter controls whether the empty option is to be shown or
not. It defaults to true, just set it to false.
As for why it has an empty option:
This is one possibility to ensure that a value gets selected by
1) presenting the user an empty dropdown box, so the user gets kinda
pushed to select something, and
2) to have an empty value for the select element, so no wrong default
value gets submitted.
Cheers,
ByteDoc
(CakePHP 1.1.6.3264 - developing a Home Accounting Application)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~----------~----~----~----~------~----~------~--~---