1

I have been facing a problem when I try to update the article from the frontend then it shows this error

Joomla.submitbutton is not a function at HTMLButtonElement.onclick

Here is my code

<div class="btn-group">
            <button type="button" class="btn btn-primary" onclick="Joomla.submitbutton('article.save')">
                <span class="icon-ok"></span><?php echo JText::_('JSAVE') ?>
            </button>
        </div>

Update

I am also facing this error

Uncaught TypeError: Joomla.getOptions is not a function

Which if I go to the source code I find this script

$.ajaxSetup({
    headers: {
        'X-CSRF-Token': Joomla.getOptions('csrf.token')
    }
});

And that script is not visible in the actual file

  • Is this an issue you're having with Joomla core, a 3rd party extension or your own code? – Lodder Jan 8 at 8:15
  • @Lodder core joomla – Zain Farooq Jan 8 at 8:20
  • And are you using the latest version of Joomla? – Lodder Jan 8 at 8:23
  • Yes joomla version is 3.9.1 – Zain Farooq Jan 8 at 8:26
  • It looks like that Joomla javascript library is not loaded somehow on the page. That's the only thing I can imagine in this case, if this is inside a core Joomla function of a core component. Thus the above mentioned functions cannot be recognized as functions. Or it could be a javascript conflict with another javascript library. – Zollie Jan 8 at 18:08
0

I have found the solution. I have removed the javascript like onclick="Joomla.submitbutton('article.save')" from the form view of com_content and added the necessary php code to make form submit to the right direction. Now the form is working fine

0

Just curious if you're working with a template override of the form.

Reason I'm asking is the function Joomla.submitbutton is typically added to the page by the template for the form.

Also, Joomla.getOptions is defined in core.js, which templates can avoid or block loading.

My guess is you're using a template that has decided for whatever reason to stop Joomla from loading the minimal javascript it needs, and the developer either wasn't aware of the right way to do that or didn't care about the side effects.

Pro tip: if you made the changes you mention directly to the core files, like your words implied, you have at most 6 months before an update breaks things by overwriting them. That's why template overrides exist.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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