1

this is my file structure in my modules: /module/com_somthing

<form class="form-horizontal" role="form" id="e_brochure" name="e_brochure"    method="post" action=">
</form>

this is my file structure in my controller.php: admin/component/com_somthing

function addreqinfo()
{
}

I want to call addreqinfo when form submit / on action

NeetaSoni
  • 11
  • 2

2 Answers2

1

Functions in the controller are called by tasks. Your action link in the form will be something like this:

JRoute::_("index.php?option=com_somthing&task=addreqinfo")

JRoute will create an SEO friendly version of the URL depending how your router is set up in the component.

Further info here: http://docs.joomla.org/Absolute_Basics_of_How_a_Component_Functions

(NB also - a module and a component are different things - worth learning the difference if you are using Joomla)

RichardB
  • 2,615
  • 1
  • 11
  • 14
  • JRoute::_("index.php?option=com_somthing&task=addreqinfo") this i already did...But i want to call task from admin/component/com_somthing/view/controller.php – NeetaSoni Jun 25 '14 at 07:18
0

Expanding on Richard's correct answer, depending on need you can call methods on a particulars views controller as well. So if you had a widgets view and wanted to use AJAX to call the update() method in the widgets controller you could using below url:

JRoute::_('index.php?option=com_something&task=widgets.update');

You can also add any needed additional parameters to the url; and as a best practice be sure to attach a token to the form or url parameters for security purposes.

Brian Bolli
  • 1,873
  • 1
  • 12
  • 14