I want to add a simple form to each row of CompleteLister. I've tried this:
<?php
class page_list extends Page {
function init(){
parent::init();
$l = $this->add('Lister_Comment',null,'comm_list_spot','comm_list_spot');
$l->setModel('Comment');
}
function defaultTemplate(){
return array('view/comment_list');
}
}
class Lister_Comment extends CompleteLister {
function formatRow(){
parent::formatRow();
$f = $this->add('Form');
$f->addField('line','com_text');
$f->addSubmit();
$this->current_row_html['commm'] = $f->getHTML();
}
}
?>
` But it doesn't work. What I do wrong?
Thank you.
Form is a delicate view and it needs to be sitting properly in a render tree. Here is how you could implement this better:
This should work much better.