使用Joomla中的JForm loadform对象在表单提交上显示消息

时间:2015-04-20 13:36:09

标签: joomla joomla3.0

我想在提交表单后显示成功消息。当前消息正在工作,它说项目已成功保存。但我也想改变这个消息。有办法还是我做错了什么。这是我的自定义组件模型中的代码示例。

class IAdonaModelPost extends JModelAdmin
{
    protected function allowEdit($data = array(), $key = 'id')
    {   
        //echo "<pre>"; print_R($data); print_r($key);die;
        //return JFactory::getUser()->authorise('core.edit',  'com_events.message.'.((int) isset($data[$key]) ? $data[$key] : 0)) or parent::allowEdit($data, $key);
    } 

    public function getTable($type = 'Eventpost', $prefix = 'iAdonaTable', $config = array()) 
    {
        return JTable::getInstance($type, $prefix, $config);
    }

    public function getForm($data = array(), $loadData = true) 
    {       

        $form = $this->loadForm('com_iadona.post', 'post', array('control' => 'jform', 'load_data' => $loadData));           

        if (empty($form)) 
        {
            return false;
        } 

        return $form;
        //$displaymsg = "My message text..";
        // JFactory::getApplication()->enqueueMessage($displaymsg);

    }

    protected function loadFormData() 
    {   
        $data = JFactory::getApplication()->getUserState('com_iadona.edit.post.data', array());
        if (empty($data)) 
        {
            $data = $this->getItem();
        }
        return $data;
    }
 } 

0 个答案:

没有答案