I've got a simple code below. After it's run once, it inserts results twice into the mysql database.
components/com_cobalt/fields/text/text.php
public function onPrepareSave($value, $record, $type, $section)
{
// START my custom code
$db = JFactory::getDbo();
// Create a new query object.
$query = $db->getQuery(true);
$query = "INSERT INTO #__moje1 (cat, sub)
VALUES ('1', $value)";
// Set the query using our newly populated query object and execute it.
$db->setQuery($query);
$db->execute();
// END my custom code
if($this->params->get('params.mask.mask') && $this->params->get('params.show_mask', 1) && ($value == $this->params->get('params.mask.mask')))
{
return null;
}
$filter = JFilterInput::getInstance();
return $filter->clean($value);
}
I've got a simple code below. After it's run once, it inserts results twice into the mysql database. components/com_cobalt/fields/text/text.php