双文本区域?带有 FOSU 的 Symfony 2

Double textarea? Symfony 2 with FOSU

我有这个奇怪的问题,我真的不知道为什么会这样。 文本区域加倍,位置不好。 看图。

因此,生成器看起来像:

public function buildForm(FormBuilderInterface $builder, array $options)
{
    $builder
        ->add('imie', 'text', array('label' => false, 'translation_domain' => 'FOSUserBundle'))
        ->add('nazwisko', 'text', array('label' => false, 'translation_domain' => 'FOSUserBundle'))
        ->add('username', null, array('label' => false, 'translation_domain' => 'FOSUserBundle'))
        ->add('email', 'email', array('label' => false, 'translation_domain' => 'FOSUserBundle'))
        ->add('telefon', 'number', array('label' => false, 'translation_domain' => 'FOSUserBundle'))
        ->add('plainPassword', 'repeated', array(
            'type' => 'password',
            'options' => array('translation_domain' => 'FOSUserBundle'),
            'first_options' => array('label' => false),
            'second_options' => array('label' => false),
            'invalid_message' => 'fos_user.password.mismatch',
        ))
        ->add('captcha', 'captcha', array(
            'label' => ' ',
            'width' => 200,
            'height' => 50,
            'length' => 6,
            'invalid_message' => 'The captcha code is invalid.'
        ))
    ;
}

和 html.twig

http://pastebin.com/2pbHqNyH

请注意,我将 symfony 与 twig 一起使用了 2 周,我还是初学者。我也是 FOSU 的新成员。我只是想将注册表格的默认外观从 FOSU 更改为适合我的网站。

那是因为你的repeated密码包含2个字段,所以plainPassword字段渲染包含无效的css结构。

替换:

<div class="form-group">
    {{ form_label(form.plainPassword, 'Hasło:', {'label_attr': {'class': 'col-sm-3 control-label'}}) }}
    <div class="col-sm-5">
        {{ form_widget(form.plainPassword, {'attr': {'class':'form-control' }}) }}
        {{ form_errors(form.plainPassword) }}
    </div>
</div>

作者:

<div class="form-group">
    {{ form_label(form.plainPassword.first, 'Hasło:', {'label_attr': {'class': 'col-sm-3 control-label'}}) }}
    <div class="col-sm-5">
        {{ form_widget(form.plainPassword.first, {'attr': {'class':'form-control' }}) }}
        {{ form_errors(form.plainPassword.first) }}
    </div>
</div>

<div class="form-group">
    {{ form_label(form.plainPassword.second, 'Hasło:', {'label_attr': {'class': 'col-sm-3 control-label'}}) }}
    <div class="col-sm-5">
        {{ form_widget(form.plainPassword.second, {'attr': {'class':'form-control' }}) }}
        {{ form_errors(form.plainPassword.second) }}
    </div>
</div>

更多详情:http://symfony.com/doc/current/reference/forms/types/repeated.html