CForm, legend, html generation & attributes

I use subforms, like:


        'title'=>'Advertiser',

        'elements'=>array(

            'company'=>array(

                'type'=>'form',

                'title'=>'General',

                'elements'=>array(

                    'full_name'=>array('type'=>'text'),

                    'trade_name'=>array('type'=>'text'),

                    'head_name'=>array('type'=>'text'),

                    'head_position'=>array('type'=>'text'),

                    'head_activity'=>array('type'=>'text'),

                ),

            ),

Code of subform, generated by CForm, looks like:


<fieldset type="form" name="company"> ....

Questions:

  1. Where is legend of subform and how I can display it?

  2. "type" and "name" are invalid attributes for fieldset tag, maybe before rendering… CForm attributes need to be cleaned?

  1. To use a sub-form:

http://www.yiiframework.com/doc/guide/form.builder#specifying-sub-form

  1. Any attributes that CForm doesn’t recognize, it typically passes on to the generated HTML as element attributes.

try to reproduce my example (nested subforms) and check output (intel352, it silly <_< , I checked latest version of manual from SVN twice before create this post)

If you remove ‘name’=>‘General’, it removes that fieldset reference, hehe.

I agree that the results aren’t what you’d necessarily expect :-\

Hey, maintainers, help to solve problem! :mellow:

Thanks. I’ve fixed this bug.

Was this an error in documentation, or in the code?

Does this change what CForm expects?

It’s a bug in code: legend for subforms are not rendered, and ‘name’ and ‘type’ should not be rendered for fieldset tag.

Qiang, thanks!

“Problem” solved 8)