Yii Framework Forum: CForm, legend, html generation & attributes - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

CForm, legend, html generation & attributes CForm incorrectly generate html Rate Topic: -----

#1 User is offline   vamp 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 181
  • Joined: 30-January 09

Posted 25 February 2010 - 08:59 AM

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?
-Posted Image-
Thanks, you make me stronger!
0

#2 User is offline   intel352 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 196
  • Joined: 05-February 10
  • Location:Southport, NC

Posted 25 February 2010 - 09:33 AM

1. To use a sub-form:
http://www.yiiframew...ifying-sub-form

2. Any attributes that CForm doesn't recognize, it typically passes on to the generated HTML as element attributes.
Need live Yii support? - Join the #yii IRC channel on Freenode!
0

#3 User is offline   vamp 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 181
  • Joined: 30-January 09

Posted 26 February 2010 - 03:30 AM

View Postintel352, on 25 February 2010 - 09:33 AM, said:

1. To use a sub-form:
http://www.yiiframew...ifying-sub-form

2. 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)
-Posted Image-
Thanks, you make me stronger!
0

#4 User is offline   intel352 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 196
  • Joined: 05-February 10
  • Location:Southport, NC

Posted 26 February 2010 - 11:21 AM

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

I agree that the results aren't what you'd necessarily expect :-\
Need live Yii support? - Join the #yii IRC channel on Freenode!
0

#5 User is offline   vamp 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 181
  • Joined: 30-January 09

Posted 01 March 2010 - 08:33 AM

Hey, maintainers, help to solve problem! :mellow:
-Posted Image-
Thanks, you make me stronger!
0

#6 User is offline   qiang 

  • Yii Project Lead
  • Yii
  • Group: Yii Dev Team
  • Posts: 5,892
  • Joined: 04-October 08
  • Location:DC, USA

Posted 01 March 2010 - 10:54 AM

Thanks. I've fixed this bug.
2

#7 User is offline   intel352 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 196
  • Joined: 05-February 10
  • Location:Southport, NC

Posted 01 March 2010 - 11:02 AM

View Postqiang, on 01 March 2010 - 10:54 AM, said:

Thanks. I've fixed this bug.


Was this an error in documentation, or in the code?
Does this change what CForm expects?
Need live Yii support? - Join the #yii IRC channel on Freenode!
0

#8 User is offline   qiang 

  • Yii Project Lead
  • Yii
  • Group: Yii Dev Team
  • Posts: 5,892
  • Joined: 04-October 08
  • Location:DC, USA

Posted 01 March 2010 - 11:06 AM

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

#9 User is offline   vamp 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 181
  • Joined: 30-January 09

Posted 02 March 2010 - 03:38 AM

View Postqiang, on 01 March 2010 - 11:06 AM, said:

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)
-Posted Image-
Thanks, you make me stronger!
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users