【问题标题】:The option "label " does not exist选项“标签”不存在
【发布时间】:2013-02-20 07:09:56
【问题描述】:

我收到以下错误

The option "label " does not exist. Known options are: "always_empty", "attr", "block_name", "by_reference", "cascade_validation", "compound", "constraints", "csrf_field_name", "csrf_protection", "csrf_provider", "data", "data_class", "disabled", "empty_data", "error_bubbling", "error_mapping", "extra_fields_message", "intention", "invalid_message", "invalid_message_parameters", "label", "label_attr", "mapped", "max_length", "pattern", "post_max_size_message", "property_path", "read_only", "required", "translation_domain", "trim", "validation_constraint", "validation_groups", "virtual"

虽然在documentation 中他们说它有一个label 选项。

我的代码如下:

namespace ....

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;

class AddNew extends AbstractType
{
    private $languages;
    public function __construct($languages){
        $this->languages = $languages;
    }
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        echo "<pre>";//debugging
        print_r($this->languages);//debugging
        $builder->add('Key');
        foreach ($this->languages as $key => $language){
        $builder->add('translation'.$key, 'password' , array('label '=>$language['description'].' translation'));

        }
    }
 some other irrelevant stuff ......
}

【问题讨论】:

    标签: php symfony symfony-2.1


    【解决方案1】:

    看起来你有一个额外的空间:"label ""label" 不同。

    【讨论】:

    • 6 小时白费吧?!
    • 我会尽可能接受答案,谢谢你的帮助..我应该注意到了!
    猜你喜欢
    • 2017-06-23
    • 1970-01-01
    • 2012-01-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-11-20
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多