Joomla Component不保存数据

Bea*_*sIV 3 joomla

我有一个以前工作的组件(没有为描述设置HTML标签),现在尝试让HTML格式化后,它将无法保存.

com_lot \意见\大量\ TMPL\form.php的:

<?php defined('_JEXEC') or die('Restricted access');
$document =& JFactory::getDocument();
$document->addScript('includes/js/joomla.javascript.js');
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 );
      return;
   }

   <?php
      $editor =& JFactory::getEditor();
      echo $editor->save( 'description' );
   ?>
   submitform(pressbutton);
}
</script>
...
      <tr>
         <td width="100" align="right" class="key">
            <label for="description">
               <?php echo JText::_( 'Description' ); ?>:
            </label>
         </td>
         <td>
            <?php
               $editor =& JFactory::getEditor();
               echo $editor->display('description', $this->lotdata->description, '550', '400', '60', '20', false);
            ?>
         </td>
      </tr>
...
<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>
</form>
Run Code Online (Sandbox Code Playgroud)

com_lot \型号\ lot.php:

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

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

   // Make sure the hello record is valid
   if (!$row->check()) {
      $this->setError($this->_db->getErrorMsg());
      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);
}
Run Code Online (Sandbox Code Playgroud)

任何帮助赞赏.

编辑:我已经看到有关JForms和XML文件的东西......这适用吗?我还没有发现任何地方,说什么他们正在使用,只是什么类型的有...

Bea*_*sIV 6

我发现问题(一旦我清理了一些代码)是我在关注的文章中(http://docs.joomla.org/How_to_use_the_editor_in_a_component)错过了更改store()来存储($ data).

因为页面重定向等它不会死亡和错误输出.感谢Jan的帮助.