how to add options with frontend pages and how to save these options in related table column

arpitjain

Member
i have created three radio buttons with create thread page for my addon and i have added a column with (xf_thread) table
i want to save selected radio button value to this column of each thread that i create ...how to save radio buttons value to related column of table ...
 
i have extend the thread controller and try to save through this code with in my action for each new resource ..is this right way
$writer = XenForo_DataWriter::create('XenForo_DataWriter_Discussion_Thread');
$writer->set('myfield', $_POST[' radiobuttonname ']);
$writer->save();
 
this is myfile that i extend with my addon DataWriter/thread.php
class FD_TitleCase_DataWriter_Thread extends XFCP_FD_TitleCase_DataWriter_Thread
{
protected function _getFields()
{
$fields = parent::_getFields();
$fields[$this->_modTableName]['t_case'] = array('type' => self::TYPE_STRING, 'default' => '');
return $fields;
}
}
and i have add this code with listner .....
public static function load_class_datawriter($class, array &$extend)
{

if($class == 'XenForo_DataWriter_Discussion_Thread')
{
$extend[] = 'FD_TitleCase_DataWriter_Thread';
}



}
bat when i create a new thread and save ... it show me an error
Undefined property: FD_TitleCase_DataWriter_Thread::$_modTableName
where is the problem ...

and i have create three radio button with this create related template with name mybuttons ...
im tring to get its value through
$text = $this->_input->filterSingle('mybuttons', XenForo_Input::STRING);
and want to save in column t_case that i want to create in xf_thread..how it is possible...please reply
 
Top Bottom