Old*_*est 2 forms label cakephp helper
我的选择表单工作正常,但无论参数的变化或排列如何,我的标签都不会显示.
这是我的代码:
<?php echo $this->Form->input('plan_detail_id', $plans_list, array(
'type' => 'select',
'label' => 'Select a the Plan Detail',
'empty' => '-- Select a the Plan Detail --'
)); ?>
Run Code Online (Sandbox Code Playgroud)
正如您所看到的,我有第二个参数$plan_list
,通常是label标签的位置.例如,我的所有其他标签都可以:
<td><?php echo $this->Form->input('age_id', array(
'label' => 'Select an Age Range',
'empty' => '-- Select an Age Range --'
)); ?></td>
Run Code Online (Sandbox Code Playgroud)
注意:没有$argument
像第一个例子那样的第二个例子.我做错了吗?或者这不可能或是一个错误?
API不会向该FormHelper::input
方法显示三个参数 ; 只有$fieldName
和$options
.您可能打算使用该FormHelper::select
方法.
$this->Form->select('plan_detail_id', $plans_list, null, array('label' => 'Select a the Plan Detail', 'empty' => '-- Select a the Plan Detail --'));
Run Code Online (Sandbox Code Playgroud)
请注意,FormHelper::select
它不包括包装<div>
或标签.要这样做,你必须传递这样的东西..
echo $this->Form->input(
'plan_detail_id',
array(
'options' => $plans_list,
'type' => 'select',
'empty' => '-- Select a the Plan Detail --',
'label' => 'Select a the Plan Detail'
)
);
Run Code Online (Sandbox Code Playgroud)
这与您最初的尝试不同,因为它$plans_list
使用options
参数集移动到数组中.