I am trying to understand Joomla's MVC logic. please help me figure out the processing of the task

Unedited code from a Joomla package has the front end article edit form with the task field, but its value is missing (file root/components/com_content/views/form/tmpl/edit.php ):

<input type="hidden" name="task" value="" />

By default, the URL of the form's action does not have a task parameter. This is how I see the URL for the action:

JRoute::_('index.php?option=com_content&a_id=' . (int) $this->item->id); ?>

I am not sure, but I think that when the flow reaches the component's entry point, in this case, file root/components/com_content/content.php, the input includes a task article.save

The input data I get is:

  &array(13) {
    string(1) "7"
    array(12) {
      string(69) "Test 1"
      string(0) ""
      string(1) "1"
      string(19) "2018-05-23 05:37:29"
      string(0) ""
      array(3) {
        string(1) "2"
        string(1) "4"
        string(1) "6"
      string(0) ""
      string(0) ""
      string(181) "<p>TEST This is some text</p>
<p>Line 1</p>
<p>Line 2</p>
<p> </p>
<p>Line 3</p>
<p> </p>
<p>Line 7</p>"
      array(1) {
        string(27) "<span class="star">@</span>"
      string(1) "8"
      string(1) "*"
    string(12) "article.save"
    string(180) "aW5kZXgucGhwP29wdGlvbj1jb21fY29udGVudCZ0YXNrPWFydGljbGUuZWRpdCZhX2lkPTcmcmV0dXJuPWFIUjBjSE02THk5c2IyTmhiR2h2YzNRdmMyaHZjblJ6ZEc5eWVTNXpjR0ZqWlM5d2RXSnNhV05mYUhSdGJDOTBaWE4wTFRFPQ=="
    string(1) "1"
    string(11) "com_content"
    string(8) "category"
    string(4) "blog"
    string(1) "8"
    string(3) "101"

Where is the task set?

Given the original edit.php file is missing a value for the task field, is there another field in this form that influences the setting of the task in a file that is called after I click the save button?

Like I try to communicate above, the component's input shows ["task"]=>string(12) "article.save" when the component's entry point file is called (i.e., root/components/com_content/content.php"

Given that the URL task parameter is missing from the form's action, does the URL from which I make the request influences the code that sets the task?

I welcome any information in helping to understand Joomla's MVC logic

1 Answer 1


If you inspect the button in the back end, you'll notice that for the most part they are <button onclick="Joomla.submitbutton('view.task');"></button>. When Joomla.submitbutton is called, the value passed into it is automatically transferred into <input type="hidden" name="task" /> if found inside of a <form> with the ID adminForm.

Otherwise, controllers automatically default all tasks to view.display if no task is given.

  • Yes; after I read your answer I noticed the button tag <button type="button" class="btn btn-primary" onclick="Joomla.submitbutton('article.save')"> Thank you
    – IberoMedia
    Commented Nov 6, 2018 at 13:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.