Yii Framework Forum: Unable to Add Form and Button in CGridView Column - Yii Framework Forum

Jump to content

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

Unable to Add Form and Button in CGridView Column Rate Topic: -----

#1 User is offline   queej 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 71
  • Joined: 04-February 10

Posted 22 February 2010 - 02:58 PM

I am using the zii CGridView to present a 3 column output for a discussion forum. The rightmost column has a bit of textual information plus a Reply button. If I add a form and a button (or just a button), the tags are stripped somewhere before displaying the column.

e.g.,
...
columns = (
    ...
    array( 'name'=> 'rightmost', 'type' => 'html', 'value' => 'Some text<form><input type="button" value="Reply"/></form>' )
    ...
)


Only the "Some text" appears in Firebug. The form and/or button element are not there.

Any idea on what I am doing wrong, if anything? Or is there some expected behavior here of which I am unaware?

Thanks in advance.
0

#2 User is offline   Y!! 

  • Advanced Member
  • Yii
  • Group: Yii Dev Team
  • Posts: 978
  • Joined: 18-June 09

Posted 22 February 2010 - 04:01 PM

The type html means the value gets purified before printed. I don't know at this time what gets stripped by default or how you can change it. However, you should use type raw in this case anyway - so the value gets printed exactly as you defined it. If you want to display user-input in a "raw" field, make sure to encode it properly.

See CFormatter for reference regarding the different types.
0

#3 User is offline   queej 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 71
  • Joined: 04-February 10

Posted 22 February 2010 - 04:02 PM

Thank you!
0

#4 User is offline   kellan4459 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 18
  • Joined: 04-November 11

Posted 17 November 2011 - 12:50 PM

Is there a way to embed CActiveForm fields in the CGridView. I have a grid view of available classes in the current session and would like to use the CActiveForm, if not I can use html but I was trying to stay consistent.



I would like the view to be
class name || class properties || form || hidden ClassID || hidden sessionID || REMOVE button || end form


also being able to create a link to an update page if you click class name
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