Thanks to visit codestin.com
Credit goes to github.com

Skip to content

radio choice form builder does not render attr #8051

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
AdamQuadmon opened this issue May 15, 2013 · 3 comments
Closed

radio choice form builder does not render attr #8051

AdamQuadmon opened this issue May 15, 2013 · 3 comments
Labels

Comments

@AdamQuadmon
Copy link

I'm trying to add attributes to my rendered radios

$builder
    ->add('myRadios', 'choice', array(
        'choices' => array(
            'one' => 'uno',
            'two' => 'due'),
        'multiple' => false,
        'attr' => array('class' => 'testClass'),
        'expanded' => true

the output is:

<div class="control-group">
    <label class="control-label required">Myradios</label>
    <div class="controls">
        <label for="form_one_0" class="required radio">
            <input type="radio" id="form_one_0" name="form[one]" required="required" value="uno" />
            <span>Uno</span>
        </label>
        <label for="form_two_1" class="required radio">
            <input type="radio" id="form_two_1" name="form[two]" required="required" value="due" />
            <span>Due</span>
        </label>
    </div>
</div>

no references to class='testClass'

I can't find any issue online

@maoueh
Copy link
Contributor

maoueh commented May 15, 2013

I think you have a double array in you attr definition.

In your example:

'attr' => array(array('class' => 'testClass')),

Should be:

'attr' => array('class' => 'testClass'),

The example in the documentation is quite clear about that.

@AdamQuadmon
Copy link
Author

sorry, the double array was a try to figure out if it works this way.
but it doesn't, even with a single array... I know the docs an example but still It does not work

@stof
Copy link
Member

stof commented May 17, 2013

This is not supported yet. Closing as duplicate of #3836

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants