输入选择表单上的 CakePHP 标签选项未按预期工作
我的选择表单工作正常,但无论参数如何变化或排列,我的标签都不会显示。
这是我的代码:
<?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 --'
)); ?>
如您所见,我有第二个参数 $plan_list
它通常是标签标记的位置。例如,我的所有其他类似标签都可以:
<td><?php echo $this->Form->input('age_id', array(
'label' => 'Select an Age Range',
'empty' => '-- Select an Age Range --'
)); ?></td>
注意:没有像第一个示例那样的第二个 $argument
。我做错了什么吗?或者这是不可能的或者是一个错误?
My select form is working perfectly, but my label will not display no matter the variation or arrangement of arguments.
Here is my code:
<?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 --'
)); ?>
As you can see I have a second argument $plan_list
which is normally the place for the label tag. For example, all of my other labels like such are OK:
<td><?php echo $this->Form->input('age_id', array(
'label' => 'Select an Age Range',
'empty' => '-- Select an Age Range --'
)); ?></td>
Note: there is no second $argument
like the first example. Am I doing something totally wrong? Or is this not possible or a bug?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
API 不向
FormHelper 显示三个参数
: :输入
方法;只有$fieldName
和$options
。您可能想改用FormHelper::select
方法。请注意,
FormHelper::select
不包含包装或标签。为此,您必须传递类似这样的内容。
这与您最初的尝试不同,它将 $plans_list 移动到带有
options
参数集的数组中。The API doesn't show three parameters to the
FormHelper::input
method; there is only$fieldName
and$options
. You probably meant to use theFormHelper::select
method instead.Note that the
FormHelper::select
does not include a wrapping<div>
or label. To do so you must pass in something like this..This differs from your original attempt in that it moves the
$plans_list
into the array with theoptions
argument set.