Joomla component does not save data

I have a component that was working (without setting up the HTML tags for the description) and now trying to get the HTML formatting to work, it won't be saved.

com_lot \ view \ lot \ tmpl \ form.php:

<?php defined('_JEXEC') or die('Restricted access');
$document =& JFactory::getDocument();
require_once(JPATH_ADMINISTRATOR .DS. 'components' .DS. 'com_jce' .DS. 'helpers' .DS. 'browser.php');
<form action="index.php" method="post" name="adminForm" id="adminForm">
<script language="javascript" type="text/javascript">
function submitbutton(pressbutton) {
   var form = document.adminForm;
   if (pressbutton == 'cancel') {
      submitform( pressbutton );

      $editor =& JFactory::getEditor();
      echo $editor->save( 'description' );
         <td width="100" align="right" class="key">
            <label for="description">
               <?php echo JText::_( 'Description' ); ?>:
               $editor =& JFactory::getEditor();
               echo $editor->display('description', $this->lotdata->description, '550', '400', '60', '20', false);
<input type="hidden" name="option" value="com_lot" />
<input type="hidden" name="lotid" value="<?php echo $this->lotdata->lotid; ?>" />
<input type="hidden" name="task" value="" />
<input type="hidden" name="controller" value="lot" />

<?php echo JHTML::_( 'form.token' ); ?>
<button type="button" onclick="submitbutton('save')"><?php echo JText::_('Save') ?></button>
<button type="button" onclick="submitbutton('cancel')"><?php echo JText::_('Cancel') ?></button>


com_lot \ models \ lot.php:

   function store($data)
   // get the table
   $row =& $this->getTable();

   // Bind the form fields to the hello table
   if (!$row->bind($data)) {
      return false;

   // Make sure the hello record is valid
   if (!$row->check()) {
      return false;

   // Store the web link table to the database
   if (!$row->store()) {
      $this->setError( $row->getErrorMsg() );
      return false;

   return true;         

   function save()
   // Check for request forgeries
   JRequest::checkToken() or jexit( 'Invalid Token' );

   // get the model
   $model =& $this->getModel();

   //get data from request
   $post = JRequest::get('post');
   $post['description'] = JRequest::getVar('description', '', 'post', 'string', JREQUEST_ALLOWRAW);

   // let the model save it
   if ($model->store($post)) {
      $message = JText::_('Success');
   } else {
      $message = JText::_('Error while saving');
      $message .= ' ['.$model->getError().'] ';
   $this->setRedirect('index.php?option=com_lot', $message);


Any help was appreciated.

Edit: I've seen stuff about JForms and XML files ... is this applicable? I haven't found anywhere that says what they are used for, but what types exist ...


source to share

1 answer

The problem I found (once I cleaned up the code a bit) was that the article I was reading ( missed changing the store () to store ($ data).

Since the pages are redirected and so on, they don't die or crash. Thanks for Jan for your help.



All Articles