0

I want to show success message after submitting the form. The currently message is working it is saying item successfully saved. But i also want to change this message. Is there a way or am i doing something wrong. This is my code example in model of my custom component.

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;
    }
 } 
Deepak S
  • 23
  • 8
  • Messages are in controller as parametar of setRedirect function. Find your task and you will find msg. – mokiSRB Apr 20 '15 at 14:15
  • in the form there is task post.save but i tried to find this task method. But i wondering how it is working without this task method. I didn't find save method anywhere in the controller as well as model. – Deepak S Apr 20 '15 at 15:09
  • In controller you will find something like this $this->registerTask('mytask, 'myfunction'); find your task in url of form action then find it in controller. First parametar is task name , second is function name. – mokiSRB Apr 20 '15 at 17:32
  • can we add new method for showing message as a system message or is there any parameter in the loadform object to show message? – Deepak S Apr 21 '15 at 07:04

0 Answers0