datawriter not working with my action... it save blank ...

i have extended the data writer and resource controller for my add on and create listener for these
and add radio button with add resource form ..and add a column call with xf_resource table but its not working ...
datawriter that i extend from xenresource datawriter..
class FD_TitleCase_DataWriter_Resource extends XFCP_FD_TitleCase_DataWriter_Resource
protected function _getFields()
{ $_modTableName='xf_resource';
$fields = parent::_getFields();
$fields[$_modTableName]['call'] = array('type' => self::TYPE_STRING, 'default' => '');
return $fields;

this is my action for my addon through which i want to save data..(extended from Resource)
public function actionSave()


$dw = XenForo_DataWriter::create('XenResource_DataWriter_Resource');
//$dw = XenForo_DataWriter::create('FD_TitleCase_DataWriter_Resource');
$= $this->_input->filterSingle('radio', XenForo_Input::STRING);
$dw->set('call',$text );
// $dw->set('call',"hello" );

return $parent;


Chris D

XenForo developer
Staff member
It's notoriously difficult to achieve what you're trying to do.

At the point where you're storing parent::actionSave() in the $parent var, the controller action has already run, its inputs have been processed and the DataWriter has been saved. You can't unfortunately just add data to the datawriter after it has already been saved, and besides, creating the datawriter will start a new transaction anyway.

So what you have to try and do is modify the input into the datawriter before it is saved. One of the few places you can do that is the preSave function of the DataWriter. You could check for $_POST params in there, or perform some other sort of function in actionSave which saves your input somewhere to be later picked up by the DataWriter preSave.

Unfortunately any method you use is likely to be a bit "ugly" but suggestions have been made with regards to this behaviour and I believe Mike is aware of the issues with extending form data submitted via controller actions to the DataWriter. But for now my suggestions should help.