Page 1 of 1

[SOLVED] Saving data from the frontend

Posted: Tue Jan 01, 2008 7:46 pm
by deepthoughts
I'm coding a component to display a simple list of events and I've hit a roadblock. I need to make it possible to add events from the frontend but when trying to save an event it throws me an 403-forbidden when the form action is set to "index.php?option=com_callisto".

Code: Select all

Forbidden
You don't have permission to access /index.php on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request. 
If I set the action to "index.php" I get redirected back to the the component but nothing is saved in the database. Could someone give me some pointers here?

My save-function looks like this:

Code: Select all

function save () {

			$option = JRequest::getCmd('option');
			$this->setRedirect('index.php?option=' . $option);

			$post = JRequest::get('post');
			$row =& JTable::getInstance('Callist', 'Table');

			if (!$row->bind($post)) {
				return JError::raiseWarning(500, $row->getError());
			}
			if (!$row->store()) {
				return JError::raiseWarning(500, $row->getError());
			}

 			$this->setMessage('Händelse inlagd');
		}
My database class looks like this:

Code: Select all

defined('_JEXEC') or die ('Restricted access');

class TableCallist extends JTable {

var $event = null;
var $eventlink = null;
var $arrangedby = null;
var $contactname = null;
var $contactphone = null;
var $contactemail = null;
var $startdate = null;
var $enddate = null;
var $lastdate = null;
var $location = null;
var $description = null;
var $city = null;
var $streetaddress = null;
var $postcode = null;
var $id = null;


function __construct(&$db)
	{
		parent::__construct( '#__callisto', 'id', $db );
	}
}

Re: Saving data from the frontend

Posted: Sun Jan 06, 2008 10:20 pm
by deepthoughts
Case closed. Idiot behind the wheels.

I'm using a template developed by myself and I was dead sure that I had included

Code: Select all

<jdoc:include type="message" />
but when I took a closer look I discovered that I hadn't. So I included it in the template and then discovered that there was an extra field in my table-definition (since I could see the error now) and when I removed that one everything works.