Reputation: 703
I'm developing a component for Joomla! 3.x and I came across a strange issue. I followed the official documentation (http://docs.joomla.org/J3.2:Developing_a_MVC_Component/Adding_backend_actions) and I was able to get somewhere. Now the problem is that I wanted to expand the tutorial and create submenus within the components menu in the backend. I succeeded with this too.
The 2 submenu selections link correctly to 2 different views and I am able to fetch data from different tables nicely. The problem is that I cant add new entry to the database using my second view. The first view works fine. On the second view, when I click the green Add button, I get a jquery error: Uncaught TypeError: Cannot read property 'task' of null
The problem is that the addNew method cant find municipality.add or something. However this (almost) same code works for the default view.
What I'm trying to do is to display the data of 2 different tables in the DB and then being able to edit delete or add new.
Any ideas? Thanks in advance
Upvotes: 0
Views: 292
Reputation: 703
Answering my own question, the problem was in the views/municipalitys/tmpl/default.php.
The form contained in that file was wrong, missing the id="adminForm" and the proper action= value.
Upvotes: 0
Reputation: 5615
The code
municipality.add
and
municipalitys.delete
refers to two different controllers, named municipality.php
and municipalitys.php
You need to ensure the methods are present, in your case municipality.php should contain a
public function add()
which is not there. For a reference on how to implement it look at the other controller (most likely you'll invoke the add()
method of the relevant model).
Or possibly you're extending the municipality
controller from a different ancestor that doesn't implement the add
method
Upvotes: 0