Unable to Add Form and Button in CGridView Column

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.

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.

Thank you!

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